Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch toolchains in CLion 2018.2?

I started trying to use of CLion 2018.2 today and the first problem with I stuck is how to switch toolchains in CLion.

I want to switch the toolchain from MinGW to Visual Studio and I can switch it by making Visual Studio toolchain as default (File->Settings->Build, Execution, Deployment->Toolchains->Select Visual Studio->Click Up arrow).

enter image description here

But I don't want to make this toolchain as default. I just wanted to try it.

Should I press this up arrow button if I want to switch toolchains or there is any simpler way?

Thanks.

like image 266
Denis Zmitrichenko Avatar asked Aug 01 '18 18:08

Denis Zmitrichenko


People also ask

What are CMake Toolchains?

CMake uses a toolchain of utilities to compile, link libraries and create archives, and other tasks to drive the build. The toolchain utilities available are determined by the languages enabled. In normal builds, CMake automatically determines the toolchain for host builds based on system introspection and defaults.

Does CLion have a compiler?

 In CLion, you can use GCC-based compilers, Clang, Clang-cl, Visual Studio C++ compiler, as well as IAR compiler and custom-defined compiler. See Compilers for more information. CLion supports debugging with GDB (either bundled or custom) on all platforms and with the bundled LLDB on macOS and Linux.

How do I add a configuration in CLion?

In CLion, go to File | Settings | Build, Execution, Deployment | Toolchains and select the Visual Studio toolchain that you want to configure, or create a new one. Point the C Compiler and C++ Compiler fields to clang-cl.exe. CLion will suggest the paths detected automatically.


1 Answers

No need to many any toolchain a default one. Do the following:

  1. Configure all necessary toolchains in settings. https://www.jetbrains.com/help/clion/how-to-create-toolchain-in-clion.html
  2. Then in Settings | Build, Execution, Deployment | CMake configure several CMake profiles using different toolchains. https://www.jetbrains.com/help/clion/configuring-cmake.html#CMProfile
  3. Then in the same switcher where you can change the run/debug configuration, there is also a list of available CMake profiles with corresponding toolchains. Select the combination you need and then you can run/debug.
like image 106
nastasiak2512 Avatar answered Nov 03 '22 20:11

nastasiak2512