Re: [PATCH] cmake.bbclass: modify construction of compiler flags
From: Slater, Joseph <hidden>
Date: 2012-09-26 18:00:23
-----Original Message----- From: Richard Purdie [mailto:richard.purdie@linuxfoundation.org] Sent: Wednesday, September 26, 2012 1:48 AM To: Slater, Joseph Cc: openembedded-core@lists.openembedded.org Subject: Re: [OE-core] [PATCH] cmake.bbclass: modify construction of compiler flags On Tue, 2012-09-25 at 14:37 -0700, Joe Slater wrote:quoted
Use CFLAGS instead of CPPFLAGS for C_FLAGS variants. Also remove duplicate flags from _RELEASE variants. Signed-off-by: Joe Slater <redacted> *** Note - this can break things that have never really *** been compiled with -O2 optimizationThis change says what you're doing but not really why. How are things broken and why is this an improvement?
The specific problem is that, since CFLAGS are ignored, there is no difference between debug (-O0) and production (-O2) builds. It also seems counter-intuitive that CXX_FLAGS are based on CXXFLAGS, but C_FLAGS are not based on CFLAGS. Joe
Cheers, Richardquoted
--- meta/classes/cmake.bbclass | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)diff --git a/meta/classes/cmake.bbclass b/meta/classes/cmake.bbclass index dcd974a..ac5c048 100644 --- a/meta/classes/cmake.bbclass +++ b/meta/classes/cmake.bbclass@@ -19,10 +19,10 @@ OECMAKE_C_COMPILER ?= "`echo ${CC} | sed 's/^\([^ ]*\).*/\1/'`" OECMAKE_CXX_COMPILER ?= "`echo ${CXX} | sed 's/^\([^ ]*\).*/\1/'`" # Compiler flags -OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CPPFLAGS}" +OECMAKE_C_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CFLAGS}" OECMAKE_CXX_FLAGS ?= "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS} ${CXXFLAGS} -fpermissive" -OECMAKE_C_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${CPPFLAGS} -DNDEBUG" -OECMAKE_CXX_FLAGS_RELEASE ?= "${SELECTED_OPTIMIZATION} ${CXXFLAGS} -DNDEBUG" +OECMAKE_C_FLAGS_RELEASE ?= "${CFLAGS} -DNDEBUG" +OECMAKE_CXX_FLAGS_RELEASE ?= "${CXXFLAGS} -DNDEBUG" OECMAKE_RPATH ?= "" OECMAKE_PERLNATIVE_DIR ??= ""