Installing Projects on the System
Explore the process of installing C++ projects on your system using CMake commands. Understand how to use the install() function to copy built artifacts, manage installation paths, set permissions, and create reusable packages. Gain knowledge to simplify project distribution and ensure platform-specific consistency.
We'll cover the following...
CMake offers following command-line mode that installs built projects on the system:
cmake --install <dir> [<options>]
<dir> is the path to the generated build tree (required). Our <options> are as follows:
--config <cfg>: This picks the build configuration for a multi-configuration generator.--component <comp>: This limits the installation to the given component.--default-directory-permissions <permissions>: This sets the default permissions for the installed directories (in<u=rwx,g=rx,o=rx>format).-
-prefix <prefix>: This specifies the non-default installation path (stored in theCMAKE_INSTALL_PREFIXvariable). It defaults to/usr/localfor Unix-like systems andc:/Program Files/${PROJECT_NAME}for Windows. ...