CLion 2022.1 Help

Compilers

In CLion, you can use GCC-based compilers, Clang, Clang-cl, Visual Studio C++ compiler, as well as IAR compiler and custom-defined compiler.

Toolchain compilers (IDE-wide)

The compilers you configure in the currently selected toolchain are used for all the projects you work with in CLion.

Change toolchain compilers

  1. Go to Settings / Preferences | Build, Execution, Deployment | Toolchains and select the toolchain you want to edit.

  2. In the C++ Compiler or C Compiler fields specify the path to the desired installation, for example:

    Set the compiler via toolchain

Project compilers

If you need to use non-default compilers, you can change the paths in toolchain settings (IDE-wide) or set the compilers manually, affecting the current project only.

Compilers for Cmake projects

For CMake projects, you can change the compilers in the CMake profile settings defined per project.

Change CMake profile compilers

  1. Go to Settings / Preferences | Build, Execution, Deployment | CMake.

  2. In the CMake options field, specify the compiler by setting the CMAKE_LANG_COMPILER variable:

    -D CMAKE_<LANG>_COMPILER=[fully qualified compiler name]

    The LANG part specifies the language (C for C and CXX for C++), and you need to provide the full path to the compiler, for example:

    Set the compiler via CMake settings

  3. After you apply the settings, CLion will reset the CMake cache and reload your project.

Last modified: 25 July 2022