[cmake-developers] CMAKE_CONFIGURATION_TYPES

Ben Boeckel ben.boeckel at kitware.com
Wed Feb 5 15:50:06 EST 2014


On Wed, Feb 05, 2014 at 12:00:41 -0700, Steve Wilson wrote:
> In the documentation for CMAKE_CONFIGURATION_TYPES it states:
> 
> “… but can be extended to provide other build types. … “
> 
> How would one provide other build types?

It's just a list with a default of
"Release;RelWithDebInfo;RelMinSize;Debug", so just add your
configuration name to the list. Please do *not* set it in other
generators which don't already use it (they use CMAKE_BUILD_TYPE) since
they only generate for a single build type at a time and some projects
have to detect whether subdirectories will be thrown into places by the
build for various reasons[1].

In order for any custom configurations to be *useful*, you'd have to
populate the variables for them (e.g., CMAKE_CXX_FLAGS_<CONFIG> and
friends).

--Ben

[1]The one I usually have to deal with is Python builds where I want to
move the configuration directory to a different place:

    lib/python/$<CONFIGURATION>/.../module.so

rather than:

    lib/python/.../$<CONFIGURATION>/module.so

For make and Ninja generators, such hackery isn't necessary because
there isn't an implicit subdirectory. Of course, if there is some way to
detect these generators other than CMAKE_CONFIGURATION_TYPES and
CMAKE_BUILD_TYPE, that would be nice as well :) .



More information about the cmake-developers mailing list