[CMake] Possible to modify COMPILE_FLAGS?

Campbell Barton ideasman42 at gmail.com
Tue Oct 25 03:51:34 EDT 2011


The problem I'm trying to solve is to have "-Werror" for the whole
project except a few files which include system headers that give
warnings we can't workaround (even with -isystem).

So I'm trying to get cmake to replace some flags for a specific file,
and I ran into the problem that the variable appears not to be set.

get_source_file_property(MYVAR intern/BME_Customdata.c COMPILE_FLAGS)
... modify the MYVAR
... set the flags back

But the variable isnt set, Im sure the source file is valid because I
printed it from the list passed to the target, and I tried this before
and after defining the source file in the target:
message(FATAL_ERROR "Check: ${MYVAR}")
Check: NOTFOUND


I'm guessing the COMPILE_FLAGS property can be set which overrides the
default flags but is there a good way to manipulate the existing
flags?

-- 
- Campbell


More information about the CMake mailing list