CMAKE_BUILD_TYPE is irrelevant with build systems that handle multiple configurations (like Xcode and Visual Studio). Makefile based systems still need CMAKE_BUILD_TYPE defined to select the type of build.<br><br><div>The flags you are setting need double quotes to work as you intend them, like this:</div>
<div>SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG=3")<br>SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG=4")<br><div class="gmail_quote"><br></div><div class="gmail_quote">I don't know about COMPILE_DEFINITIONS_DEBUG.</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">HTH,</div><div class="gmail_quote">David</div><div class="gmail_quote"><br></div><div class="gmail_quote">On Fri, Mar 20, 2009 at 2:38 PM, Eric Sokolowsky <span dir="ltr"><<a href="mailto:esok.osg@gmail.com">esok.osg@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">How do you tell Cmake to add a compiler flag to a project's Debug target?<br>
<br>
In a project I'm trying to fix (OpenSceneGraph) it looks like Cmake<br>
generates an Xcode project file containing all four of the build types:<br>
Debug, Release, ReleaseMinSize, and RelWithDebInfo. These types can be<br>
selected from within Xcode. Is it therefore true that there is no need<br>
to set CMAKE_BUILD_TYPE on OSX? To gain understanding of what cmake is<br>
doing, I have the following lines at the beginning of the CMakeLists.txt:<br>
<br>
SET(COMPILE_DEFINITIONS_DEBUG ${COMPILE_DEFINITIONS_DEBUG} -D_DEBUG=2)<br>
SET(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG=3)<br>
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} -D_DEBUG=4)<br>
add_definitions(-D_DEBUG=5)<br>
<br>
And I put these lines at the end of the file:<br>
<br>
SET(COMPILE_DEFINITIONS_DEBUG ${COMPILE_DEFINITIONS_DEBUG} -D_DEBUG=6)<br>
SET(CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG=7)<br>
SET(CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG} -D_DEBUG=8)<br>
add_definitions(-D_DEBUG=9)<br>
<br>
When I look in the build directory I only see instances of "-D_DEBUG=5"<br>
and "-D_DEBUG=9". The Cmake documentation implies that at least one of<br>
the other lines should do *something*, but they appear to do nothing.<br>
<br>
Can anyone explain what is going on? Thanks.<br>
<br>
-Eric<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></div>