On Tue, Nov 3, 2009 at 10:40 PM, Alex H <span dir="ltr">&lt;<a href="mailto:aditya15417@hotmail.com">aditya15417@hotmail.com</a>&gt;</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: &#39;Segoe UI&#39;,Tahoma,Verdana,Arial,sans-serif; color: rgb(68, 68, 68);">Okay here&#39;s what I&#39;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&#39;t seem to work for me, for example.<br>
<br>In the meantime you&#39;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>