[Cmake] Adding a debug switch with CMake
Neil Killeen
Neil . Killeen at atnf . csiro . au
Tue, 10 Jun 2003 13:18:58 +1000 (EST)
I'd like my system to be so that I can build
with the debugger if need be.
Ideally, I'd like to be able to turn the debugger on
for selected code only.
With CMake, it seems to me that I have to turn it
on for everything. Thus, in CMakeLists.txt I have
at present
# Debug ?
OPTION (DEBUG "Turn on the debugging compiler options ?" OFF)
IF (DEBUG)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g")
ENDIF (DEBUG)
this means the user must rerun cmake and regenerate the
Makefiles which will enable global debugging.
I'd prefer it if I could have the user issue the command
% make debug
and for that directory the debugger is turned on.
Is it possible to configure CMake to have a 'debug'
target in this way ?
thanks
Neil