Run CMake targets before launch
CMake targets can be executed automatically before the launch of a run/debug configuration. This covers both the built-in CMake targets like all
or clean
and the targets specified via add_executable
or add_custom_target
.
In the main menu, go to Run | Edit Configurations and select a CMake Application or a test configuration to edit.
In the Before launch area, click
and select CMake Target:
tip
For the
install
target, you can also use another task called Install. See CMake install.In the dialog that opens, select the desired target:
Set the Run with root privileges checkbox to run the target with administrative privileges:
Save the settings. Next time you run or debug this configuration, the specified target will be executed before launch.
note
The Before launch tasks are performed in the order they appear in the list.
Thanks for your feedback!