CLion 2018.3 Help

Build Configuration Types

By default, CMake supports the following build types:

  • Debug,

  • Release,

  • RelWithDebInfo,

  • MinSizeRel.

You can select the required build type in the CMake settings dialog.

In CLion, you can create as many build types as needed for your development lifecycle. Use the CMake Settings dialog and choose the configuration that is optimal for the current purposes. For example, the following code sample will be executed only if the Debug build type is selected:

int main(int argc, const char* argv[]) { #if DEBUG printf("Executing as \"%s\"\n", argv[0]); #endif ...
For another configuration type (such as Release), this code will be ignored.

In this example, DEBUG must be defined in CMakeLists.txt file as follows:

if (CMAKE_BUILD_TYPE MATCHES Debug) add_definitions(-DDEBUG=1) endif()

Last modified: 7 December 2018