Switching between toolchains per project

Answered

Hi. Maybe I have not fully understood how the toolchain management works in CLion. Here is my situation:

There are times that I need to have 2 instances of CLion. one for a native toolchain (e.g. Visaul Studio) and one for a cross compiler (e.g arm-linux):

What should I do when starting CLion in this case? Should I open up the Settings and for each instance move the desired toolchain to the top place?

 

In general, how to switch between toolchains, or set default toolchain PER PROJECT.

1
4 comments

Hello!

>Should I open up the Settings and for each instance move the desired toolchain to the top place?

The toolchain settings (`File | Settings | Build, Execution, Deployment | Toolchains` ) are global, so this won't work.

There are project-specific settings for this purpose:

If you work with CMake projects, you can specify what toolchain should be used for this particular project in the CMake profile (`File | Settings | Build, Execution, Deployment | CMake`).

In case of Makefile projects, you can do that in `File | Settings | Build, Execution, Deployment | Makefile` (https://www.jetbrains.com/help/clion/makefiles-support.html#makefile-settings).

2

Hi, I have a similar problem. I have multiple projects, each project has it's own Python virtual environment, and I install a project specific CMake executable via pip into the local virtual environment. Now I want to use the local cmake for each project.

I'm using cmake preset files too, and in this combination the toolchain selection in “CMake profile” is grayed out, I cannot select my specific toolchain. 

Do I miss something here?

1

Thank you very much, it works now. It's a little bit tricky I would say ;) I was struggling for some time, it didn't work with my first attempts, until I read the doc multiple times, this sentence is very important: “To set one of the already configured toolchains, modify the vendor-specific field of the configure preset.” I tried first to use the global “vendor” object, which doesn't work. 

I define it now in an inherited default configuration preset, this works fine.

0

Please sign in to leave a comment.