CMake Command: Other Operations
Let's learn about the commands used to install and run a project in CMake.
Installing a project
When artifacts are built, users can install them on the system. Usually, this means copying files into the correct directories, installing libraries, or running some custom installation logic from a CMake script.
The syntax of the installation mode
cmake --install <dir> [<options>]
As with other modes of operation, CMake requires a path to a generated build tree:
cmake --install <dir>
Options for multi-configuration generators
Just like in the build stage, we can specify which build type we want to use for our installation. The available types include Debug
, Release
, MinSizeRel
, and RelWithDebInfo
. The signature is as follows:
cmake --install <dir> --config <cfg>
Options for components
As a developer, we might choose to split our project into components that can be installed independently. They represent different parts of the solution. This might be something like application
, ...