CLion 2021.3 Help

CMake install

If your workflow includes project installation, you may want to use the CMake install command that generates installation rules.

Configure and run installation

  1. Place the install commands into your CMakeLists.txt files.

  2. Set up the installation paths via the [DESTINATION dir] field of the install command. Here you have two options:

    • Provide the full path with a leading slash or drive letter.

    • Use a relative path, which will be interpreted as relative to the value of the CMAKE_INSTALL_PREFIX variable, if provided in the CMake options section of the Settings/Preferences | Build, Execution, Deployment dialog:

      CMake install options

    • To run the installation only, call Build | Install from the main menu:

      call install from the main menu
    • If you want the installation to automatically precede the launch, open the Run | Edit Configurations dialog, choose the desired Run/Debug configuration, press Icons general add in the Before launch section, and choose Install from the drop-down list:

      Install as a pre-launch step

      Then call Run or Debug for this configuration.

    As a result, the targets you specified in the install commands will be built and put into the desired directories.

Last modified: 08 March 2021