[CMake] How to specify target specific CPPFLAGS or CFLAGS?

Clark J. Wang dearvoid at gmail.com
Tue May 15 08:42:53 EDT 2007


Thanks, Eric.

The FM is not as easy to understand as the FMs of autotools :)
I prefer TexInfo format manuals. It's much readable than man pages but I
find no TexInfo manuals in CMake's package :(

On 5/15/07, Eric Noulard <eric.noulard at gmail.com> wrote:
>
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070515/cbaabcdb/attachment.html


More information about the CMake mailing list