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.
tip
There is also a preprocessor macro __CLION_IDE__ that helps avoid IDE freezes during the parsing of some intricate preprocessor code blocks. With this macro, you can eliminate such problematic definitions or includes from your code and replace them with dummy ones.
__CLION_IDE__ macro affects parsing only.
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:
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions. Learn more.
With your consent, JetBrains may also use cookies and your IP address to collect individual statistics and provide you with personalized offers and ads subject to the Privacy Notice and the Terms of Use. JetBrains may use third-party services for this purpose. You can adjust or withdraw your consent at any time by visiting the Opt-Out page.