CLion 2020.3 EAP: More Makefile Project Support!
Last week we started the CLion 2020.3 EAP which introduced CTest, some MISRA checks, Clang completion snippets, and a brand-new Set Execution Point debugger action. Today we are happy to share a fresh new EAP build with you! Build 203.4203.24 is available from our website, via the Toolbox App, or as a snap package (if you are using Ubuntu).
Today, it’s all about Makefiles! Makefile project support was just recently introduced in CLion 2020.2. We are seeing growing interest and increased use of Makefile projects, and we definitely want to develop Makefile support further by fixing issues and removing known limitations. Here are the highlights:
- A more user-friendly UI.
- Configurations for run and debug are now automatically created for Makefile projects in CLion.
- Support for projects with libtool, dolt and ccache.
A more user-friendly UI
Makefile project support is still in active development and there are still many things that are not yet supported or are simply not working correctly. We’ve added some notifications to help users identify such cases:
A UI notification about an unsupported toolchain is displayed when a remote toolchain is selected in Settings / Preferences | Build, Execution, Deployment | Makefile:
Meanwhile, feel free to vote for the corresponding request in our tracker.
- If loading the project fails, CLion now suggests a Check Settings quick-fix for all error messages in the log. This action simply opens the Makefile settings – as quite often tuning the arguments or switching the toolchain helps.
Run/Debug configurations in Makefile projects
CLion has included support for Makefile projects since v2020.2. Starting from this EAP build, the Run/Debug configurations are created automatically for the targets in the top-level Makefile when loading the project:
Configurations are not blindly created for all the targets. Some of them are filtered out:
- Clean target.
- Targets that correspond to object files (.o files).
- Targets that end with unknown file extensions (e.g. .d files).
This means it’s now even easier to set up a Makefile project in CLion! Once the project is loaded you can build the configuration, and after pointing it to the created executable you can run and debug your application in CLion with no additional configuration required. (Don’t forget to build with the debug symbols to be able to debug the application.)
One important thing to note here is that CLion doesn’t search project sub-directories for additional (nested) targets, only the top-level Makefile is analyzed.
Support for projects with libtool and ccache
Along with the first iteration of Makefile projects support in CLion, we’ve also published a long list of projects that our team has tested this support on. Reading this list, you may notice that a large portion of projects remained unsupported because of their various wrappers. Such tools made things worse by hiding the compilation flags and interfering with the Make’s output. This made it impossible for CLion to correctly parse the
make command’s output and load the project. But this limitation is now gone!
If you’ve never used these tools before, here’s a brief overview:
- Ccache is a compiler cache that speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again.
- Libtool (and its alternative implementations like Dolt, slibtool, and jlibtool) is a tool that helps create portable compiled libraries by encapsulating both the platform-specific dependencies and the user interface.
Starting from this EAP build, if your Makefile project uses these tools you can still load it successfully in CLion and benefit from smart coding assistance. For example, here we open OpenZFS in CLion:
However, there are still a few small limitations we want to mention here:
Projects with the
automakemacros are still not supported (CPP-20126), so projects like curl or mono still can’t be loaded correctly.
Distccis not yet supported (CPP-19305).
There may be issues with parsing the options. If options or option values passed to
libtooland others are enclosed in single or double quotes, CLion’s parser currently can’t recognize them correctly.
In addition to Makefile changes, this EAP also brings:
- New MISRA checks. See the full list of the currently supported checks on our Confluence page. And also fixes for the existing checks.
- In CTest support, we introduced more user-friendly handling of unsupported CTest version 3.13 and earlie, as well as some fixes for the run icons in the left-hand gutter and the names of the automatically created Run/Debug configurations.
- A bug was fixed where CLion couldn’t automatically detect NMake if Visual Studio is used in the toolchains settings.
A problem with the Inline refactoring when
__COUNTER__is used in a macro was fixed (CPP-10622).
We also fixed an exception that led to the project folders disappearing from the "Project" menu in CLion 2020.3 EAP (CPP-22267). If you don’t have such an exception in your log file and just have similar symptoms (absence of project folders in Project View), it may be caused by a different bug and it’s worth filing a separate issue and attaching the log to it.
Your CLion team
The Drive to Develop