Meson projects
In CLion, you can create, open, build, and run/debug Meson projects. Meson support works on all platforms and for all local and remote toolchains, including WSL and Docker.
Install Meson
Follow the official installation guide to install Meson on your system.
Create a Meson project
Select New Project on the Welcome screen.
from the main menu or clickIn the left-hand pane, select Meson.
Specify the project name and type, and select the language standard:
Click Create.
CLion will generate a simple project containing main.cpp and meson.build:
Open a Meson project
Select Open on the Welcome screen.
from the main menu or clickPoint CLion to the directory containing meson.build and click Open.
CLion will load the Meson project structure and show the results in the Build tool window:
Meson tool window
To open the Meson tool window, click on the right-hand toolbar or select
from the main menu.In this window, you can find the list of build targets, and useful commands, like clean
, install
, test
, configure
, and others:
Double-click on a command or target to run it. The tooptip on hover will show the exact command that will be applied:
Use the toolbar to perform project actions and quickly access the project settings:
Meson project settings
Go to
or click in the Meson tool window.Use this dialog to configure the following:
Toolchain — select one the configured toolchains.
Meson executable — specify a custom Meson executable, if required.
Setup options — use this field for additional Meson commands, such as
--native-file
.Build directory — check or change the build directory.
Build options — provide additional build options, if required.
Edit meson.build with assistance
CLion highlights the code in meson.build scripts. To adjust the color scheme, go to .
You can use the Structure view to navigate to targets, dependencies, and option commands in meson.build and meson_options.txt.
Press Alt+7 to open the Structure tool window or Ctrl+F12 to open the Structure popup.
Reload the project
When you make changes in meson.build, CLion shows an icon suggesting to reload the project:
Click the icon or press the shortcut.
Alternatively, click in the Meson tool window.
Another option is to use the Tools | Meson menu:
Select Wipe and reload Meson Project to perform a wipe before reload.
Run/debug configurations for Meson
CLion detects the project build targets and creates the Native Application configurations for them:
In the main menu, go to
to set up additional parameters if required:
Build, run, and debug
Use the actions in the
menu to build the project or the selected configuration.To run or debug your program, you can use the configuration widget (click or ), the
menu, or the gutter icons next to the program's entry point:Refer to Run applications and Debug for more information.