On Tue, Nov 3, 2009 at 10:40 PM, Alex H <[email protected]> wrote:

>  Okay here's what I've done so far:
>
> add_definitions(-DV_FILM)
> add_executable(hassel-film has-main.cpp)
>
> remove_definitions(-DV_FILM)
> add_definitions(-DV_DIGITAL)
> add_executable(hassel-digital has-main.cpp)
>
> What I want to do is after running cmake . and typing it make. I want to
> generate two executable, one is hassel-film which is has-main.cpp compiled
> with the flag -V_FILM
> and the other one is hassel-digital which is compiled with the flag
> -V_DIGITAL. How can I do this? The above code will compile with V_DIGITAL
> flag, which is not what I want.
>

It would sure be great if in a future policy of CMake, add_definitions()
behaved the way you describe it.  I remember trying something similar a long
time ago and being equally dumbfounded.  There are other inconsistencies in
how CMake behaves.  Changing the CMAKE_CXX_FLAGS in-between add_executable()
calls also doesn't seem to work for me, for example.

In the meantime you're probably can make do with set_target_properties(),
specifically the COMPILE_FLAGS property.
http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set_target_properties


-- 
Philip Lowman
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to