[CMake] How to specify target specific CPPFLAGS or CFLAGS?
Eric Noulard
eric.noulard at gmail.com
Tue May 15 07:38:39 EDT 2007
2007/5/15, Clark J. Wang <dearvoid at gmail.com>:
> I have a C source file `foo.c' and I want to produce 2 executables like
> this:
>
> $ gcc -DFLAG_1 -o foo_1 foo.c
> $ gcc -DFLAG_2 -o foo_2 foo.c
>
> How should I write the CMake rules?
RTFM :))
May be you can try
ADD_EXECUTABLE(foo_1 foo.c)
SET_TARGET_PROPERTIES(foo_1
PROPERTIES COMPILE_FLAGS "-DFLAG_1")
ADD_EXECUTABLE(foo_2 foo.c)
SET_TARGET_PROPERTIES(foo_2
PROPERTIES COMPILE_FLAGS "-DFLAG_2")
--
Erk
More information about the CMake
mailing list