CLion 2017.1 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.


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

See Also

Last modified: 19 July 2017