CLion 2019.1 Help

CLion IDE macro for CMake

In some cases, you may want a CMake script to detect whether it is being called from CLion or another instance like console. For this, use the special environment variable CLION_IDE. This variable is platform-independent and is only TRUE when CMake generation or build is invoked from CLion.

Using the CLION_IDE variable, you can set specific paths (for example, customize build directories), execute additional scripts, or add extra logging.

Placing this variable into your CMake code is easy with the environment variables completion available for CMakeLists.txt files:

code completion for environment variables in cmake files

Last modified: 12 June 2019

See Also