CLion 2019.3 EAP: Ninja or Another Generator of Your Choice in CMake
A new CLion 2019.3 EAP (build 193.4697.8) is now available! Get it from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu). A patch-update for anyone using the previous EAP build will be available shortly.
CMake remains the most deeply integrated project model in CLion. However, from the very beginning, we supported only the Makefiles generator. This limitation was caused by the fact that CLion was parsing the output of CMake command run with parameters such as -G “CodeBlocks – Unix Makefiles”, -G "CodeBlocks – MinGW Makefiles", or -G "CodeBlocks – NMake Makefiles" to get information about the project, which made it impossible to change the generator used.
This obviously caused some problems:
- Ninja is known to be a much faster generator and is one of the most requested alternatives (CPP-2659).
- With the Visual Studio toolchain, CLion was using something very similar to Makefiles – NMake, but the community expected Visual Studio CMake generators (CPP-14730).
As a solution, we considered supporting the CMake server first, but later found a better alternative – the new CMake File API, which was added by the CMake authors as a new and better way to query project information. And now, we are happy to present to you the new CLion 2019.3 build with this new API supported!
In practice, this gives you an opportunity to use any CMake generator of your choice!
Let’s look at the details.
How can I change the generator?
A very simple action is required to change the generator – just go to the CMake Profile settings in Settings / Preferences | Build, Execution, Deployment | CMake and pass the generator name in the CMake options, for example, -G Ninja:
This works for all platforms, remote mode, and the WSL, and for all generators supported by CMake (Ninja, Xcode, Visual Studio, and Makefiles). And you can use different generators in different CMake Profiles if necessary.
There are, however, a few things to bear in mind:
- While CMake File API first appeared in CMake 3.14, CLion supports the feature only with CMake 3.15 or higher. (Currently, CMake 3.15.3 is bundled into the 2019.3 EAP builds, so you don’t have to install anything additionally, if you simply rely on a bundled version.)
- Make sure you have the generator itself installed on your machine (like Ninja, for example).
- Recompiling individual files is not supported in cases where the generator was changed as CLion can’t restore the build rules information easily (CPP-17622).
How do build type settings work for multi-configuration generators?
Xcode and Visual Studio are so-called multi-configuration generators, which means the project files for all build types will be generated by CMake. However, CLion will only use the build type specified in the CMake Profile settings for indexing and the actual building (in the build command line arguments, you can find the proper config is passed by CLion, for example: –config Debug).
That’s it for today! The full release notes are available here.
Your CLion Team
The Drive to Develop
Subscribe to Blog updates
Thanks, we've got you!
CLion 2023.3 Release Candidate
CLion 2023.3 is on its way, and the release candidate for v2023.3 is already available! To install CLion 2023.3 RC (build 233.11799.171), download it from the website, update via the Toolbox App, or use this snap package (for Ubuntu). You need an active subscription or a trial license to use CLi…
CLion Nova: A New Update With Various Bug Fixes
CLion Nova, a free preview of CLion with the ReSharper C++/Rider C++ language engine, was announced recently. We’re excited to see how well you liked the first build! There are about 3,700 users right now and the overall feedback is mostly positive, especially that which is related to performance an…
CLion 2023.3 Goes Beta
The Beta version of CLion Classic 2023.3 is now available with key improvements and changes that are expected in the upcoming release. Download build 233.11799.37 from our website, via the Toolbox App, or as a snap package for Ubuntu. If you are using CLion Nova, note that we do not plan to release…
CLion Nova Explodes onto the C and C++ Development Scene
TL;DR Today, we’re announcing a free early preview of CLion, which uses the ReSharper C++/Rider C++ language engine instead of the CLion "legacy" engine. The Preview build is available via our dedicated Toolbox App feed. At some point in 2024, depending on the results of the feedback coll…