[cmake-developers] Flag ordering

Orion Poplawski orion at cora.nwra.com
Thu Apr 18 12:16:00 EDT 2013


On 04/18/2013 09:54 AM, Brad King wrote:
> 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
>

Seems reasonable.  My one comment is that I tend to look at setting CFLAGS to 
be the final word on the subject because it is done on a per build basis.  I'm 
pretty sure the auto* tools take this approach that any user specified flags 
come after any project specified flags.

The CMAKE_*_FLAGS_RELEASE option works for us though.

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion at nwra.com
Boulder, CO 80301                   http://www.nwra.com



More information about the cmake-developers mailing list