[cmake-developers] target property COMPILE_FLAGS_<CONFIG>

Brad King brad.king at kitware.com
Thu Sep 6 09:33:19 EDT 2012


On 09/06/2012 09:11 AM, Michael Stürmer wrote:
> Ok, it was easier than I feared. COMPILE_FLAGS_<CONFIG> works now for me 
> with VS 2010 (and makefiles as well I hope, did not test that one so 
> far). I'm not yet sure if I enhance it to <LANG>_FLAGS_<CONFIG> but this 
> will do for me for now.

Thanks for working on this.

> I found a feature request from some years ago dealing with this:
> 
> http://public.kitware.com/Bug/view.php?id=6493
> 
> If I find the time to add documentation and Tests in future I will 
> upload this. If someone is just interested in getting the patches, email me.

One problem with the COMPILE_FLAGS setting is for historical
reasons it is just treated as a string to be dumped on the
final command line.  If any non-trivial characters are needed
it is up to the user to do the escaping right for each platform.

Please see these comments in that issue:

 http://www.cmake.org/Bug/view.php?id=6493#c13821
 http://www.cmake.org/Bug/view.php?id=6493#c21559

The idea is to instead add new settings

 COMPILE_OPTIONS
 COMPILE_OPTIONS_<CONFIG>

that are semicolon-separated lists of raw options.  CMake will
handle escaping them for the final command line.  The linked topic
that I started is pretty old now but should be a good reference.

Thanks,
-Brad



More information about the cmake-developers mailing list