Attaching a different compiler other than GCC to Clion IDE on Windows

10.1k views Asked by At

I am developing with Clion and minigw-w64. The IDE uses cmake.

I discovered a bug in GCC that is forcing me to switch compilers, I have no choice. The bug has to do with how gcc handles stack alignment. Clion seems to only support minigw and cygwin on windows, which I believe are both tool sets that use the gcc compiler.

Is there an easy way to get Clion / cmake to use a different compiler? I've read that clang is very similar to GCC because it accepts the same compiler flags, so I wonder if this might be a good alternative. I've also read you can change the compiler that cmake uses just by changing some flags, but I don't know in which file to put this, or if changing this will break compatibility with Clion.

1

There are 1 answers

3
Cory Kramer On BEST ANSWER

From CLion's FAQ

At present CLion supports GCC and Clang compilers and is guided by these two to get the libraries and headers paths. In the next releases we are planning to extend the list of compilers available in CLion.
To change the compiler, go to the Cache tab in CMake tool window and set the compiler’s path to the CMAKE_CXX_COMPILER variable. Then press Enter and click the Apply Changes and Reload button:

enter image description here

Search our issue tracker for feature requests about supporting other compilers to follow or vote on them, or add a new one if it’s missing.