[cmake-developers] Flag ordering

Brad King brad.king at kitware.com
Thu Apr 18 11:54:24 EDT 2013


On 04/18/2013 11:24 AM, Orion Poplawski wrote:
> Can anyone tell me why the default CMAKE*_FLAGS_*_INIT values get placed 
> *after* the specified CFLAGS?  This makes it hard to override the -O value 
> specified there.

Per-config flags are more specific than general flags.  Options
like -O are config-specific so are better set directly in config-
specific places.  In general we do not like to depend on flag
ordering and prefer to specify a particular flag once rather than
overriding it later.

The _INIT values are just for initializing the cache entries.
You can always specify

 -DCMAKE_C_FLAGS_RELEASE="-O2"

yourself to change the optimization level for the release config.

-Brad



More information about the cmake-developers mailing list