We have a new CLion 2019.1 EAP, build 191.5849.15! You can get it from our website, Toolbox App, or through a snap package (if you are using Ubuntu). The patches will be available shortly for those of you who are using the previous EAP build.
Build-system independent Build Targets and Run/Debug Configurations
Starting from v2018.2 CLion supports compilation database project format (along with CMake and Gradle for C++). The main issue was that the compilation database itself lacks the information about building and thus running the whole project. So only code editing was available for it in CLion. Earlier in 2019.1 EAP, we added the ability to configure Build/Clean tools for compilation database projects (simply configure external tools and provide them in the settings as build/clean commands).
And now the next big step – we generalized the approach and added the ability to create:
- Custom Build Targets: find them in Settings/Preferences | Build, Execution, Deployment | Custom Build Targets
- Custom Run/Debug Configurations: check the Custom Build Application template in Run | Edit Configurations…
The main advantage is that both of them are completely independent of any build system/project model. But of course, they are most useful in the case of compilation database projects.
How exactly does it work?
First of all, you need a custom target, so that CLion knows what to build. For this, go to Settings/Preferences | Build, Execution, Deployment | Custom Build Targets and configure one:
Here build_with_make and clean_with_make are external tools we’ve configured for this project to build and clean TscanBuild target:
Now you can Build/Rebuild your project from within CLion! But what if you’d like to Run and Debug your custom target in CLion? That’s also possible with this EAP! Open Run | Edit Configurations… dialog and create a configuration based on the Custom Build Application template:
Select the custom target from the drop-down list, put in the executable you need to run/debug and add in any other options you find useful:
By the way, remember you were setting Toolchain in the Custom Build Target configuration above? The environment (for example, on Windows, the choice between Cygwin, MinGW, VS, WSL, or Remote) and the debugger will be taken from it and used here in the Run/Debug configuration. So, for example, if you like to debug with some custom GDB version, create a corresponding toolchain -> provide it in the Custom Build Target -> select this Custom Build Target in your Custom Build Application.
That’s it! Now you can Run, Debug, and even Profile your application from CLion.
Other changes include:
- Cygwin supported version is increased to Cygwin 3.0
- Several fixes for Extract refactoring (CPP-3085, CPP-3086, CPP-5834, CPP-12461)
- ClangFormat: a collection of actions were updated to work with ClangFormat when enabled:
- Reformat results of Generate actions
- Reformat Refactoring results
- Reformat on paste
- Reformat block on typing
- Reformat on quick-fixes and intention actions
There is one pesky issue still left (CPP-15283) with the unexpected swapping of include headers after completion in the case of ClangFormat. We hope to address it in the next EAP build.
Brief overview of 2019.1 EAP
Let’s take a quick look back at the other features and enhancements already delivered in CLion 2019.1 EAP:
- Clangd: code highlighting and quick-fixes on Clangd
- Embedded Development: OpenOCD debugger support and integration with STM32CubeMX
- Code style:
And this doesn’t count the dozens of bug-fixes in various areas! Download and try the new EAP build right away! We are looking forward to your feedback!
That’s it. The full release notes are here.
Your CLion Team
The Drive to Develop