[CMake] Determining debug & release configurations

Robert Dailey rcdailey.lists at gmail.com
Thu Dec 6 12:54:42 EST 2012


Does anyone have any code that can detect if a given configuration (by
name) is a debug or release configuration? This should work in both
single-configuration and multi-configuration generators.

For example, in Visual Studio:

Release -> Release
MinSizeRel -> Release
RelWithDebInfo -> Release
Debug -> Debug

Also any custom-added configurations should also work.

For single configuration generators, it should also work. Example:

CMAKE_BUILD_TYPE -> MinSizeRel -> should evaluate to "Release".
CMAKE_BUILD_TYPE -> Debug -> should evaluate to "Debug".

Thanks in advance.

I'm creating 1 custom target per configuration that will copy third
party DLL dependencies to the binary output directory. I store my
third party binaries in "release" and "debug" directories, which is
why I need to know whether or not a specific configuration falls into
either of those more general configuration categories.


More information about the CMake mailing list