CMake install
If your workflow includes project installation, you may want to use the CMake install command that generates installation rules.
tip
CMake install invokes building targets, thus you don't need to call the Build action separately.
Place the install commands into your CMakeLists.txt files.
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 | Build, Execution, Deployment | CMake dialog:
To run the installation only, call Build | Install from the main menu.
In the main menu, go to Run | Edit Configurations and select the configuration to which you want to add the installation step.
Click
in the Before launch area and select Install:
tip
If you need to run the installation with root privileges, use the CMake Target option instead.
Run or Debug the configuration.
note
To prevent building the targets twice, exclude the Build step after adding Install.
As a result, the targets you specified in the install commands will be built and put into the specified directories.
Thanks for your feedback!