Slow build times



I have a bigger CMake project which builds very slowly in CLion. I timed the following builds:

  • CLion with MinGW - 9:50
  • CLion with MSVC - 8:15
  • ninja + MinGW - 6:50
  • VisualStudio sln with precompiled headers - 1:50

The last two builds were done using command line. All four builds were done after a Clean and all using the same CMakeLists.txt. Difference between MinGW and Visual studio are that for Visual Studio precompiled headers are used for one of the libraries. 

In CLion if I want to run and debug my code I have to use the MinGW build (VS debugger doesn't compare yet). As you can see the Visual Studio build is about 5 times faster, which means I now edit code in CLion and then run Visual Studio and build and debug there. I would much prefer running my code from CLion so editing, compiling and debugging is done in the same IDE. Is there something I can do to speed up CLion build times?

I got used to CLion style of IDE by using Android Studio and I would love to continue doing so. But with such slow builds I am slowly considering switching to Visual Studio for my C++ development. 


Edit: forgot to mention I am using CLion 2019.3 EAP

Comment actions Permalink


Right now we are working on supporting CMake File AP ( to allow using Ninja and other generators. Feel free to comment or upvote the issues in order to get updates ( and follow updates in our blog (

As for the ways to speed up CLion build times: CLion just launches the CMake build procedure. You can try running builds "CMake + MinGW" and "CMake + MSVC" from the command line and compare the results with "CLion with MinGW" and "CLion with MSVC". Please let us know if they are very different.

Comment actions Permalink

All four builds were done using CMake. The first two using CLion, the second two by calling CMake through command line. The biggest difference is when using Visual Studio as a generator the precompiled headers get used and the speed up is enormous. MinGW build is slow with or without CLion, however with using Ninja as a generator, it is still 30% faster than CLion. 

From what I can see, CLion uses CodeBlocks as a generator no matter what compiler I use. With VisualStudio compiler, this means that precompiled headers as configured for VisualStudio generator do not work, which loses a huge speed up opportunity. 

Comment actions Permalink

I did some more tests. I installed CMake 3.16.0-rc1 since it got support for precompiled headers. I got the following results:

  • CLion with MinGW - 4:30
  • ninja + MinGW - 3:10
  • VisualStudio generator - 1:50

I got a significant speed up, but CLion still lags behind other CMake builds. I didn't even try to build CLion + MSVC, becuase it didn't seem to make much of a difference, since the CLion doesn't even use multi threaded compiling when using Visual C++ compiler.

Comment actions Permalink

>MinGW build is slow with or without CLion

This is the only comparison that makes sense to do now. 

As I wrote before, we're going to support using other generators in the near future (in the upcoming CLion 2019.3 EAP builds). Please follow the updates in the blog if you're interested to give this feature a try. 



Please sign in to leave a comment.