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
Go toand select the toolchain you want to edit.
In the C++ Compiler or C Compiler fields specify the path to the desired installation, for example:
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
In the CMake options field, specify the compiler by setting the CMAKE_LANG_COMPILER variable:-D CMAKE_<LANG>_COMPILER=[fully qualified compiler name]
LANGpart specifies the language (C for C and CXX for C++), and you need to provide the full path to the compiler, for example:
After you apply the settings, CLion will reset the CMake cache and reload your project.