CLion
 
Get CLion
You are viewing the documentation for an earlier version of CLion.

Managing Meson projects (applicable to other build systems)

Last modified: 08 March 2021

This article describes a workaround which you can use to work with Meson or other build system in CLion using compilation databases and File Watchers.

Our example shows how to construct a meta build system which monitors changes in the Meson build script, and then regenerates and reloads the compilation database accordingly. This way, it lets you manage a Meson project to a full extent from within CLion. Moreover, you can build and run/debug such projects with the help of custom build targets and custom Run/Debug configurations.

This way, the combination of a File Watcher and a compilation database creates a mechanism to work with Meson projects without leaving CLion to edit the build scripts or recreate the compilation database manually. You can apply this approach to any build system that has complementary tools for generating compilation databases.

Note that currently, in this scheme, CLion reloads the entire compilation database for each change in the meson.build that triggers the File Watcher. Due to that, you may experience performance problems when applying this workflow to large code bases.

As the next steps, you can build and run/debug Meson projects with the help of custom build targets and custom Run/Debug configurations.