[OE-core] [PATCH] cmake.bbclass: modify construction of compiler flags

Slater, Joseph joe.slater at windriver.com
Wed Sep 26 17:47:29 UTC 2012



> -----Original Message-----
> From: Richard Purdie [mailto:richard.purdie at linuxfoundation.org]
> Sent: Wednesday, September 26, 2012 1:48 AM
> To: Slater, Joseph
> Cc: openembedded-core at 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:
> > Use CFLAGS instead of CPPFLAGS for C_FLAGS variants.
> > Also remove duplicate flags from _RELEASE variants.
> >
> > Signed-off-by: Joe Slater <jslater at windriver.com>
> >
> > *** Note - this can break things that have never really
> > ***        been compiled with -O2 optimization
> 
> This 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,
> 
> Richard
> 
> > ---
> >  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 ??= ""
> 



More information about the Openembedded-core mailing list