Enrico Franchi wrote:

On Feb 28, 2009, at 10:48 AM, Kermit Mei wrote:

Hello, is there any elegant way to add "-DDEBUG" to the complier flag
just in command line?

IF(${CMAKE_BUILD_TYPE} STREQUAL Debug)
MESSAGE("Adding Debug flag...")
ADD_DEFINITIONS(-DDEBUG)
ENDIF(${CMAKE_BUILD_TYPE} STREQUAL Debug)

Thanks, but when I run without debug, something goes wrong:
$ cmake -DCMAKE_INSTALL_PREFIX=/usr ..
CMake Error at CMakeLists.txt:9 (IF):
if had incorrect arguments: ${CMAKE_BUILD_TYPE} STREQUAL Debug (Unknown arguments specified).
... ...
Adding Debug flag...


As you see, Whenever I set -DCMAKE_BUILD_TYPE=Debug,
the statement within if-endif is always be run.



_______________________________________________
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