[CMake] What is the best way to change default settings

Daniel daniel at connect2.com
Fri Aug 10 02:34:36 EDT 2007


Frank Hilliger wrote:
> I want to remove the /GZ flag which is set for Windows Visual C++ compilers
> in CMAKE_CXX_FLAGS_DEBUG_INIT. Furthermore I want to remove some .lib files
> defined in CMAKE_C_STANDARD_LIBRARIES_INIT. 
> How I can achieve this without touching
> CMake\Modules\Platform\Windows-cl.cmake  ?
> I tried remove_definitions(), but without success.

You could use an override file, do something like this _before_ the PROJECT() macro:

SET(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX CxxOverrides.cmake)
or a universal one:
SET(CMAKE_USER_MAKE_RULES_OVERRIDE Overrides.cmake)

This file will get read before Windows-cl.cmake, so you can set all of the _INIT 
variables, I _THINK_ once a _INIT variable is set, it will not be reset.  Might 
want to double check that though.
--
Daniel



More information about the CMake mailing list