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)
I had google it, and everything goes well:
OPTION(DEFINE_DEBUG
"Build the project using debugging code"
OFF)
IF(DEFINE_DEBUG)
MESSAGE("Adding Debug flag...")
ADD_DEFINITIONS(-DDEBUG)
SET(CMAKE_BUILD_TYPE Debug)
MESSAGE("Build type is " ${CMAKE_BUILD_TYPE})
ENDIF(DEFINE_DEBUG)
And ues the following command to add debug build:
$ cmake -DDEFINE_DEBUG=ON -DCMAKE_INSTALL_PREFIX=/usr ..
Thank you, all the same;p
_______________________________________________
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