AW: [CMake] Overriding default values

Sören Freudiger muffmolch at gmx.de
Fri Sep 2 05:21:33 EDT 2005


to add new flags is quite simple (e.g. /wd4996):

#first remove existing flag (elsewise eachtime you'll configuring you will
add this option again)
REMOVE(CMAKE_CXX_FLAGS "/wd4996") 
#then add the "new option"
SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "/wd4996")
#last thing is adding ";/wd4996" so you have to reomove the semicolon:
STRING(REGEX REPLACE ";" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
#or by doing this
REMOVE(CMAKE_CXX_FLAGS ";") 

#if you also want to change the cache variable:
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE STRING "common C++ build
flags" FORCE)

if there's a better, shorter way, plaese let me know!

-----Ursprüngliche Nachricht-----
Von: cmake-bounces+muffmolch=gmx.de at cmake.org
[mailto:cmake-bounces+muffmolch=gmx.de at cmake.org] Im Auftrag von James
Bigler
Gesendet: Donnerstag, 1. September 2005 23:25
An: cmake at cmake.org
Betreff: [CMake] Overriding default values

CMake attempts to provide some values for the following variables:

CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG            -g
CMAKE_CXX_FLAGS_MINSIZEREL       -O3
CMAKE_CXX_FLAGS_RELEASE          -O2
CMAKE_CXX_FLAGS_RELWITHDEBINFO   -O2

How can I change the default and allow the user to make changes the persists
across configuation?

Thanks,
James
_______________________________________________
CMake mailing list
CMake at cmake.org
http://www.cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list