[CMake] how to use CMAKE_CXX_FLAGS_DEBUG and CMAKE_CXX_FLAGS_RELEASE ?

Alexander Neundorf a.neundorf-work at gmx.net
Sun Feb 19 15:27:11 EST 2006


Hi, 
 
CMAKE_CXX_FLAGS_RELEASE and CMAKE_CXX_FLAGS_DEBUG are appended to 
CMAKE_CXX_FLAGS if the buildtype is release or debug. 
 
Now let's say I'd like to have the following flags: 
default: -Wall -fno-rtti -O2 -g  
release: -Wall -fno-rtti -O2 
debug:   -Wall -fno-rtti -O0 -g 
 
I can't set CMAKE_CXX_FLAGS to "-Wall -fno-rtti -O2" because the -O2 will 
conflict with the -O0 for the debug build. 
I would have expected either this behaviour: 
 
SET(CMAKE_CXX_FLAGS_RELEASE "-Wall -fno-rtti -O2") 
SET(CMAKE_CXX_FLAGS_DEBUG  "-Wall -fno-rtti -O0 -g") 
SET(CMAKE_CXX_FLAGS "-Wall -fno-rtti -O2 -g" )  
 
or: 
SET(CMAKE_CXX_FLAGS_DEFAULT "-O2 -g") 
SET(CMAKE_CXX_FLAGS_RELEASE "-O2") 
SET(CMAKE_CXX_FLAGS_DEBUG  "-O0 -g") 
SET(CMAKE_CXX_FLAGS "-Wall -fno-rtti" )  
 
But the special FLAGS are always appended to the general FLAGS and 
(AFAIK) there is no such variable like CMAKE_CXX_FLAGS_DEFAULT. 
 
So, how is it intended to be used ? 
 
Bye 
Alex 
 

-- 
Lust, ein paar Euro nebenbei zu verdienen? Ohne Kosten, ohne Risiko!
Satte Provisionen für GMX Partner: http://www.gmx.net/de/go/partner


More information about the CMake mailing list