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

Brad King brad.king at kitware.com
Thu Jul 7 10:39:25 EDT 2005


Lars Nordlund wrote:
> 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.

This is not currently possible but there is a feature request for it:

http://www.cmake.org/Bug/bug.php?op=show&bugid=987&pos=1

-Brad


More information about the CMake mailing list