[CMake] Different CFLAGS on source files in the same project/binary/library

Lars Nordlund lars.nordlund at hem.utfors.se
Mon Jul 4 18:16:09 EDT 2005


Hello

Suppose I want to have different warning flags on source files in the
same project. How do I do it?

SET_SOURCE_FILES_PROPERTIES() with the property COMPILE_FLAGS will
prepend the extra options. Most compilers I know about will let the
last flag on the command line win.

Changing CMAKE_C_FLAGS will hit the entire project.

Is it possible?

While investigating this I first thought that the various
CMAKE_XXX_FLAGS variables were somehow bound to each source file and
changeable through SET_SOURCE_FILES_PROPERTIES. But that was not the
case.


Best regards
	Lars Nordlund


More information about the CMake mailing list