# CMake install

If your workflow includes project installation, you may want to use the [CMake install](https://cmake.org/cmake/help/v3.12/command/install.html) command that generates installation rules.

> **Tip:**
> CMake install invokes building targets, thus you don't need to call the Build action separately.

Procedure: Configure installation

1. Place the install commands into your [CMakeLists.txt](cmakelists-txt-file.html) 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](https://cmake.org/cmake/help/v3.10/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX) variable, if provided in the `CMake options` section of the `Settings | Build, Execution, Deployment | CMake` dialog: ![CMake install options](https://resources.jetbrains.com/help/img/idea/2026.2/cl_CmakeInstall_Prefix.png)

Procedure: Run installation only

1. To run the installation only, call `Build | Install` from the main menu.

Procedure: Run installation before launch

1. In the main menu, go to `Run | Edit Configurations` and select the configuration to which you want to add the installation step.

2. Click ![](https://resources.jetbrains.com/help/img/idea/2026.2/app-client.expui.general.add.svg) in the Before launch area and select Install:

![Install as a pre-launch step](https://resources.jetbrains.com/help/img/idea/2026.2/cl_CmakeInstall_BeforeLaunch.png)

> **Tip:**
> If you need to run the installation with root privileges, use the [CMake Target](running-cmake-targets-before-launch.html) option instead.

3. 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.

## See also

### How tos

[Quick CMake tutorial](quick-cmake-tutorial.html) [CMake Profiles](cmake-profile.html) [Run CMake targets before launch](running-cmake-targets-before-launch.html)

