[CMake] CMAKE_CONFIGURATION_TYPES and CMAKE_BUILD_TYPE_INIT ...

Brad King brad.king at kitware.com
Tue Apr 4 09:42:34 EDT 2006


Eric BOIX wrote:
> I'm trying to do the following things:
>  1/ set up a default CMAKE_BUILD_TYPE for my project (say RelWithDebInfo)
>     that of course shows up in the GUIs,

To get options in the GUI they need to be cache settings.  Use the CACHE 
form of the SET command.

IF(NOT CMAKE_BUILD_TYPE)
   SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
       "Build Configuration")
ENDIF(NOT CMAKE_BUILD_TYPE)

>  2/ adding a new custom BUILD_TYPE (let's call it Maintainer).
[snip]
> After some more googling I started to believe that some possible
> answers to 2/ were:
>  *  SET( CMAKE_BUILD_TYPE Maintainer )
>     SET( CMAKE_CXX_FLAGS_MAINTAINER "-Wall")
>     SET( CMAKE_C_FLAGS_MAINTAINER "-Wall")
>     SET( CMAKE_EXE_LINKER_FLAGS_MAINTAINER "--no-allow-shlib-undefined")
>   as stated by the "Compilers and Tools" section of
>     http://www.cmake.org/Wiki/CMake_Useful_Variables 
>   but this doesn't show up in the GUI. Maybe it is sufficient to 
>   CACHE those variables, but then the Wiki page needs to be completed...

These variables will be used during generation but to get them in the 
GUI they do need to be cached.

 >  * Based on the usage of CMAKE_CONFIGURATION_TYPES
 >   as stated by
 >      http://public.kitware.com/pipermail/cmake/2003-November/004482.html
 >   allthough the comment of the code provided by
 >     http://www.itk.org/pipermail/insight-users/2003-May/003580.html
 >   makes me feel that this is a way for restricting the default 
configuration
 >   types and not to extend them...

This is correct.  Eventually we would like to allow extending the list 
with this variable but it requires some reworking of certain generators.

-Brad


More information about the CMake mailing list