On Tue, Nov 3, 2009 at 10:40 PM, Alex H <span dir="ltr"><<a href="mailto:aditya15417@hotmail.com">aditya15417@hotmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<span style="font-family: 'Segoe UI',Tahoma,Verdana,Arial,sans-serif; color: rgb(68, 68, 68);">Okay here's what I've done so far:<div><br></div><div><div>add_definitions(-DV_FILM)</div><div>add_executable(hassel-film has-main.cpp)</div>
<div><br></div><div>remove_definitions(-DV_FILM)</div><div>add_definitions(-DV_DIGITAL)</div><div>add_executable(hassel-digital has-main.cpp)</div><div><br></div>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 </div>
<div>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.<br></div></span></div></blockquote><div><br>
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.<br>
<br>In the meantime you're probably can make do with set_target_properties(), specifically the COMPILE_FLAGS property.<br><a href="http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set_target_properties">http://www.cmake.org/cmake/help/cmake2.6docs.html#command:set_target_properties</a><br>
<br></div></div><br>-- <br>Philip Lowman<br>