[CMake] Per-target compiler flags?

Brad King brad.king at kitware.com
Wed Jul 5 10:33:32 EDT 2006


Remi Denis-Courmont wrote:
>    Hello,
> 
> I am trying to port a project to CMake, but I couldn't find anyway to specify
> C preprocessor defines on a per-target (or alternatively, per-source) basis.
> The project is compiling the same source files multiple times with different
> defines, resulting in different object code... But it seems like
> ADD_DEFINITIONS won't support this case.

SET_TARGET_PROPERTIES(mytarget PROPERTIES COMPILE_FLAGS -DMY_TARGET_DEF)

-Brad


More information about the CMake mailing list