Use COMPILE_FLAGS target property. Like this:<br><br>set_target_properties(Exec2 PROPERTIES COMPILE_FLAGS "/flag1 /flag2")<br><br>You can see full list of properties in CMake documentation. Note that compiler flags may be also set for particular source file with set_source_files_properties command.<br>
<br><div class="gmail_quote">On Thu, Mar 24, 2011 at 5:44 PM, David Doria <span dir="ltr"><<a href="mailto:daviddoria@gmail.com">daviddoria@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Is there a way to explicitly set the CMAKE_CXX_FLAGS for a particular<br>
executable? That is, if I set CMAKE_CXX_FLAGS and then have a<br>
add_executable line, then change CMAKE_CXX_FLAGS and then have another<br>
add_executable, will the first set of CMAKE_CXX_FLAGS be applied to<br>
the first executable and the second set of CMAKE_CXX_FLAGS be applied<br>
to the second executable?<br>
<br>
I guess my confusion is that I don't understand how CMake variables are cached.<br>
<br>
Each time I modify the variable, should I do it using<br>
<br>
SET(CMAKE_CXX_FLAGS "some flags")<br>
<br>
or<br>
<br>
SET(CMAKE_CXX_FLAGS "some flags" CACHE STRING "compiler flags")<br>
<br>
?<br>
<br>
In this example: <a href="http://codepad.org/PGJRBjss" target="_blank">http://codepad.org/PGJRBjss</a> the messages are actually<br>
not displayed at all, which is only adding to my confusion :)<br>
<br>
Any comments on this?<br>
<br>
Thanks,<br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div><br>