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

haibin zhang dragzhb at yahoo.com.cn
Tue May 15 10:47:27 EDT 2007


Hi ,
Just as said, How can I change CFLAGS in configure in cmake?
for example in autotool:
//remove debug option
./configure --prefix=/opt  CFLAGS=-O2

How to do it in cmake ?

regards


Eric Noulard <eric.noulard at gmail.com> 写道: 2007/5/15, Clark J. Wang :
> 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
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake


 		
---------------------------------
抢注雅虎免费邮箱-3.5G容量,20M附件! 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20070515/82ef1b58/attachment.htm


More information about the CMake mailing list