[Cmake] Some problems

Bill Hoffman bill . hoffman at kitware . com
Wed, 18 Jun 2003 10:03:10 -0400


OK, I see.   

The PROJECT command enables the language and sets many of the
built-in variables.   So, CMAKE_BUILD_TYPE is set by cmake, and
the default value can not be overridden.   So, after the PROJECT
command the variable has already been initialized and can not be
re-initialized.

The way around this is to create a project specific variable. 

SET(MY_BUILD_TYPE RELEASE CACHE STRING "Debug/Release")
SET(CMAKE_BUILD_TYPE ${MY_BUILD_TYPE} CACHE STATIC "see MY_BUILD_TYPE")


Then CMAKE_BUILD_TYPE would always be set to MY_BUILD_TYPE.



-Bill


At 09:18 AM 6/18/2003, David Svoboda wrote:


>Yes, I understand. But when I use 
>
>        SET (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Debug/Release")
>        PROJECT(<project name>)
>
>and run ccmake, the required value of appropriate variable
>CMAKE_BUILD_TYPE is displayed in the ccmake environment and is correctly
>set.
>
>If I use
>
>        PROJECT(<project name>)
>        SET (CMAKE_BUILD_TYPE RELEASE CACHE STRING "Debug/Release")
>
>(i.e. different order)
>the value of the appropriate varialble is set as from vendor of CMake (it
>is empty), i.e. the second line is suppressed. What is the point?
>
>
>-David