CLion 2017.3 Help

Detecting Origin of CMake Invocation

For some projects, you may want to have a capability to identify the instance that invokes CMake: CLion or another instance (console, for example). Such a feature could be useful when your project should have different options or functionality depending on CMake invocation origin.

To control and identify that, CLion suggests a special variable CLION_IDE which you can use in CMakeLists.txt file. This variable is TRUE when CMake is invoked from CLion IDE.

Example

if ($ENV{CLION_IDE}) <Some code is here> endif ()

Last modified: 27 March 2018

See Also