CLion 2021.2 Help

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.

  1. Go to Run | Edit Configuration and select a CMake Application or a test configuration to edit.

  2. In the Before launch area, click Icons general add and select CMake Target:
    Adding CMake targets before launch
  3. In the dialog that opens, select the desired target:

    Adding CMake targets before launch

  4. Save the settings. Next time you run or debug this configuration, the specified target will be executed before launch.

Last modified: 24 May 2021