install.rst 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. install
  2. -------
  3. Specify rules to run at install time.
  4. Synopsis
  5. ^^^^^^^^
  6. .. parsed-literal::
  7. install(`TARGETS`_ <target>... [...])
  8. install(`IMPORTED_RUNTIME_ARTIFACTS`_ <target>... [...])
  9. install({`FILES`_ | `PROGRAMS`_} <file>... [...])
  10. install(`DIRECTORY`_ <dir>... [...])
  11. install(`SCRIPT`_ <file> [...])
  12. install(`CODE`_ <code> [...])
  13. install(`EXPORT`_ <export-name> [...])
  14. install(`RUNTIME_DEPENDENCY_SET`_ <set-name> [...])
  15. Introduction
  16. ^^^^^^^^^^^^
  17. This command generates installation rules for a project. Install rules
  18. specified by calls to the ``install()`` command within a source directory
  19. are executed in order during installation.
  20. .. versionchanged:: 3.14
  21. Install rules in subdirectories
  22. added by calls to the :command:`add_subdirectory` command are interleaved
  23. with those in the parent directory to run in the order declared (see
  24. policy :policy:`CMP0082`).
  25. .. versionchanged:: 3.22
  26. The environment variable :envvar:`CMAKE_INSTALL_MODE` can override the
  27. default copying behavior of :command:`install()`.
  28. There are multiple signatures for this command. Some of them define
  29. installation options for files and targets. Options common to
  30. multiple signatures are covered here but they are valid only for
  31. signatures that specify them. The common options are:
  32. ``DESTINATION``
  33. Specify the directory on disk to which a file will be installed.
  34. Arguments can be relative or absolute paths.
  35. If a relative path is given it is interpreted relative to the value
  36. of the :variable:`CMAKE_INSTALL_PREFIX` variable.
  37. The prefix can be relocated at install time using the ``DESTDIR``
  38. mechanism explained in the :variable:`CMAKE_INSTALL_PREFIX` variable
  39. documentation.
  40. If an absolute path (with a leading slash or drive letter) is given
  41. it is used verbatim.
  42. As absolute paths are not supported by :manual:`cpack <cpack(1)>` installer
  43. generators, it is preferable to use relative paths throughout.
  44. In particular, there is no need to make paths absolute by prepending
  45. :variable:`CMAKE_INSTALL_PREFIX`; this prefix is used by default if
  46. the DESTINATION is a relative path.
  47. ``PERMISSIONS``
  48. Specify permissions for installed files. Valid permissions are
  49. ``OWNER_READ``, ``OWNER_WRITE``, ``OWNER_EXECUTE``, ``GROUP_READ``,
  50. ``GROUP_WRITE``, ``GROUP_EXECUTE``, ``WORLD_READ``, ``WORLD_WRITE``,
  51. ``WORLD_EXECUTE``, ``SETUID``, and ``SETGID``. Permissions that do
  52. not make sense on certain platforms are ignored on those platforms.
  53. ``CONFIGURATIONS``
  54. Specify a list of build configurations for which the install rule
  55. applies (Debug, Release, etc.). Note that the values specified for
  56. this option only apply to options listed AFTER the ``CONFIGURATIONS``
  57. option. For example, to set separate install paths for the Debug and
  58. Release configurations, do the following:
  59. .. code-block:: cmake
  60. install(TARGETS target
  61. CONFIGURATIONS Debug
  62. RUNTIME DESTINATION Debug/bin)
  63. install(TARGETS target
  64. CONFIGURATIONS Release
  65. RUNTIME DESTINATION Release/bin)
  66. Note that ``CONFIGURATIONS`` appears BEFORE ``RUNTIME DESTINATION``.
  67. ``COMPONENT``
  68. Specify an installation component name with which the install rule
  69. is associated, such as ``Runtime`` or ``Development``. During
  70. component-specific installation only install rules associated with
  71. the given component name will be executed. During a full installation
  72. all components are installed unless marked with ``EXCLUDE_FROM_ALL``.
  73. If ``COMPONENT`` is not provided a default component "Unspecified" is
  74. created. The default component name may be controlled with the
  75. :variable:`CMAKE_INSTALL_DEFAULT_COMPONENT_NAME` variable.
  76. ``EXCLUDE_FROM_ALL``
  77. .. versionadded:: 3.6
  78. Specify that the file is excluded from a full installation and only
  79. installed as part of a component-specific installation
  80. ``RENAME``
  81. Specify a name for an installed file that may be different from the
  82. original file. Renaming is allowed only when a single file is
  83. installed by the command.
  84. ``OPTIONAL``
  85. Specify that it is not an error if the file to be installed does
  86. not exist.
  87. .. versionadded:: 3.1
  88. Command signatures that install files may print messages during
  89. installation. Use the :variable:`CMAKE_INSTALL_MESSAGE` variable
  90. to control which messages are printed.
  91. .. versionadded:: 3.11
  92. Many of the ``install()`` variants implicitly create the directories
  93. containing the installed files. If
  94. :variable:`CMAKE_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS` is set, these
  95. directories will be created with the permissions specified. Otherwise,
  96. they will be created according to the uname rules on Unix-like platforms.
  97. Windows platforms are unaffected.
  98. Installing Targets
  99. ^^^^^^^^^^^^^^^^^^
  100. .. _`install(TARGETS)`:
  101. .. _TARGETS:
  102. .. code-block:: cmake
  103. install(TARGETS targets... [EXPORT <export-name>]
  104. [RUNTIME_DEPENDENCIES args...|RUNTIME_DEPENDENCY_SET <set-name>]
  105. [[ARCHIVE|LIBRARY|RUNTIME|OBJECTS|FRAMEWORK|BUNDLE|
  106. PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE|FILE_SET <set-name>|CXX_MODULES_BMI]
  107. [DESTINATION <dir>]
  108. [PERMISSIONS permissions...]
  109. [CONFIGURATIONS [Debug|Release|...]]
  110. [COMPONENT <component>]
  111. [NAMELINK_COMPONENT <component>]
  112. [OPTIONAL] [EXCLUDE_FROM_ALL]
  113. [NAMELINK_ONLY|NAMELINK_SKIP]
  114. ] [...]
  115. [INCLUDES DESTINATION [<dir> ...]]
  116. )
  117. The ``TARGETS`` form specifies rules for installing targets from a
  118. project. There are several kinds of target :ref:`Output Artifacts`
  119. that may be installed:
  120. ``ARCHIVE``
  121. Target artifacts of this kind include:
  122. * *Static libraries*
  123. (except on macOS when marked as ``FRAMEWORK``, see below);
  124. * *DLL import libraries*
  125. (on all Windows-based systems including Cygwin; they have extension
  126. ``.lib``, in contrast to the ``.dll`` libraries that go to ``RUNTIME``);
  127. * On AIX, the *linker import file* created for executables with
  128. :prop_tgt:`ENABLE_EXPORTS` enabled.
  129. ``LIBRARY``
  130. Target artifacts of this kind include:
  131. * *Shared libraries*, except
  132. - DLLs (these go to ``RUNTIME``, see below),
  133. - on macOS when marked as ``FRAMEWORK`` (see below).
  134. ``RUNTIME``
  135. Target artifacts of this kind include:
  136. * *Executables*
  137. (except on macOS when marked as ``MACOSX_BUNDLE``, see ``BUNDLE`` below);
  138. * DLLs (on all Windows-based systems including Cygwin; note that the
  139. accompanying import libraries are of kind ``ARCHIVE``).
  140. ``OBJECTS``
  141. .. versionadded:: 3.9
  142. Object files associated with *object libraries*.
  143. ``FRAMEWORK``
  144. Both static and shared libraries marked with the ``FRAMEWORK``
  145. property are treated as ``FRAMEWORK`` targets on macOS.
  146. ``BUNDLE``
  147. Executables marked with the :prop_tgt:`MACOSX_BUNDLE` property are treated as
  148. ``BUNDLE`` targets on macOS.
  149. ``PUBLIC_HEADER``
  150. Any :prop_tgt:`PUBLIC_HEADER` files associated with a library are installed in
  151. the destination specified by the ``PUBLIC_HEADER`` argument on non-Apple
  152. platforms. Rules defined by this argument are ignored for :prop_tgt:`FRAMEWORK`
  153. libraries on Apple platforms because the associated files are installed
  154. into the appropriate locations inside the framework folder. See
  155. :prop_tgt:`PUBLIC_HEADER` for details.
  156. ``PRIVATE_HEADER``
  157. Similar to ``PUBLIC_HEADER``, but for ``PRIVATE_HEADER`` files. See
  158. :prop_tgt:`PRIVATE_HEADER` for details.
  159. ``RESOURCE``
  160. Similar to ``PUBLIC_HEADER`` and ``PRIVATE_HEADER``, but for
  161. ``RESOURCE`` files. See :prop_tgt:`RESOURCE` for details.
  162. ``FILE_SET <set>``
  163. .. versionadded:: 3.23
  164. File sets are defined by the :command:`target_sources(FILE_SET)` command.
  165. If the file set ``<set>`` exists and is ``PUBLIC`` or ``INTERFACE``, any
  166. files in the set are installed under the destination (see below).
  167. The directory structure relative to the file set's base directories is
  168. preserved. For example, a file added to the file set as
  169. ``/blah/include/myproj/here.h`` with a base directory ``/blah/include``
  170. would be installed to ``myproj/here.h`` below the destination.
  171. ``CXX_MODULES_BMI``
  172. .. note ::
  173. Experimental. Gated by ``CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API``
  174. Any module files from C++ modules from ``PUBLIC`` sources in a file set of
  175. type ``CXX_MODULES`` will be installed to the given ``DESTINATION``. All
  176. modules are placed directly in the destination as no directory structure is
  177. derived from the names of the modules. An empty ``DESTINATION`` may be used
  178. to suppress installing these files (for use in generic code).
  179. For each of these arguments given, the arguments following them only apply
  180. to the target or file type specified in the argument. If none is given, the
  181. installation properties apply to all target types. If only one is given then
  182. only targets of that type will be installed (which can be used to install
  183. just a DLL or just an import library.)
  184. For regular executables, static libraries and shared libraries, the
  185. ``DESTINATION`` argument is not required. For these target types, when
  186. ``DESTINATION`` is omitted, a default destination will be taken from the
  187. appropriate variable from :module:`GNUInstallDirs`, or set to a built-in
  188. default value if that variable is not defined. The same is true for file
  189. sets, and the public and private headers associated with the installed
  190. targets through the :prop_tgt:`PUBLIC_HEADER` and :prop_tgt:`PRIVATE_HEADER`
  191. target properties. A destination must always be provided for module libraries,
  192. Apple bundles and frameworks. A destination can be omitted for interface and
  193. object libraries, but they are handled differently (see the discussion of this
  194. topic toward the end of this section).
  195. The following table shows the target types with their associated variables and
  196. built-in defaults that apply when no destination is given:
  197. =============================== =============================== ======================
  198. Target Type GNUInstallDirs Variable Built-In Default
  199. =============================== =============================== ======================
  200. ``RUNTIME`` ``${CMAKE_INSTALL_BINDIR}`` ``bin``
  201. ``LIBRARY`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
  202. ``ARCHIVE`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
  203. ``PRIVATE_HEADER`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
  204. ``PUBLIC_HEADER`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
  205. ``FILE_SET`` (type ``HEADERS``) ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
  206. =============================== =============================== ======================
  207. Projects wishing to follow the common practice of installing headers into a
  208. project-specific subdirectory may prefer using file sets with appropriate
  209. paths and base directories. Otherwise, they must provide a ``DESTINATION``
  210. instead of being able to rely on the above (see next example below).
  211. To make packages compliant with distribution filesystem layout policies, if
  212. projects must specify a ``DESTINATION``, it is recommended that they use a
  213. path that begins with the appropriate :module:`GNUInstallDirs` variable.
  214. This allows package maintainers to control the install destination by setting
  215. the appropriate cache variables. The following example shows a static library
  216. being installed to the default destination provided by
  217. :module:`GNUInstallDirs`, but with its headers installed to a project-specific
  218. subdirectory without using file sets:
  219. .. code-block:: cmake
  220. add_library(mylib STATIC ...)
  221. set_target_properties(mylib PROPERTIES PUBLIC_HEADER mylib.h)
  222. include(GNUInstallDirs)
  223. install(TARGETS mylib
  224. PUBLIC_HEADER
  225. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/myproj
  226. )
  227. In addition to the common options listed above, each target can accept
  228. the following additional arguments:
  229. ``NAMELINK_COMPONENT``
  230. .. versionadded:: 3.12
  231. On some platforms a versioned shared library has a symbolic link such
  232. as::
  233. lib<name>.so -> lib<name>.so.1
  234. where ``lib<name>.so.1`` is the soname of the library and ``lib<name>.so``
  235. is a "namelink" allowing linkers to find the library when given
  236. ``-l<name>``. The ``NAMELINK_COMPONENT`` option is similar to the
  237. ``COMPONENT`` option, but it changes the installation component of a shared
  238. library namelink if one is generated. If not specified, this defaults to the
  239. value of ``COMPONENT``. It is an error to use this parameter outside of a
  240. ``LIBRARY`` block.
  241. Consider the following example:
  242. .. code-block:: cmake
  243. install(TARGETS mylib
  244. LIBRARY
  245. COMPONENT Libraries
  246. NAMELINK_COMPONENT Development
  247. PUBLIC_HEADER
  248. COMPONENT Development
  249. )
  250. In this scenario, if you choose to install only the ``Development``
  251. component, both the headers and namelink will be installed without the
  252. library. (If you don't also install the ``Libraries`` component, the
  253. namelink will be a dangling symlink, and projects that link to the library
  254. will have build errors.) If you install only the ``Libraries`` component,
  255. only the library will be installed, without the headers and namelink.
  256. This option is typically used for package managers that have separate
  257. runtime and development packages. For example, on Debian systems, the
  258. library is expected to be in the runtime package, and the headers and
  259. namelink are expected to be in the development package.
  260. See the :prop_tgt:`VERSION` and :prop_tgt:`SOVERSION` target properties for
  261. details on creating versioned shared libraries.
  262. ``NAMELINK_ONLY``
  263. This option causes the installation of only the namelink when a library
  264. target is installed. On platforms where versioned shared libraries do not
  265. have namelinks or when a library is not versioned, the ``NAMELINK_ONLY``
  266. option installs nothing. It is an error to use this parameter outside of a
  267. ``LIBRARY`` block.
  268. When ``NAMELINK_ONLY`` is given, either ``NAMELINK_COMPONENT`` or
  269. ``COMPONENT`` may be used to specify the installation component of the
  270. namelink, but ``COMPONENT`` should generally be preferred.
  271. ``NAMELINK_SKIP``
  272. Similar to ``NAMELINK_ONLY``, but it has the opposite effect: it causes the
  273. installation of library files other than the namelink when a library target
  274. is installed. When neither ``NAMELINK_ONLY`` or ``NAMELINK_SKIP`` are given,
  275. both portions are installed. On platforms where versioned shared libraries
  276. do not have symlinks or when a library is not versioned, ``NAMELINK_SKIP``
  277. installs the library. It is an error to use this parameter outside of a
  278. ``LIBRARY`` block.
  279. If ``NAMELINK_SKIP`` is specified, ``NAMELINK_COMPONENT`` has no effect. It
  280. is not recommended to use ``NAMELINK_SKIP`` in conjunction with
  281. ``NAMELINK_COMPONENT``.
  282. The `install(TARGETS)`_ command can also accept the following options at the
  283. top level:
  284. ``EXPORT``
  285. This option associates the installed target files with an export called
  286. ``<export-name>``. It must appear before any target options. To actually
  287. install the export file itself, call `install(EXPORT)`_, documented below.
  288. See documentation of the :prop_tgt:`EXPORT_NAME` target property to change
  289. the name of the exported target.
  290. If ``EXPORT`` is used and the targets include ``PUBLIC`` or ``INTERFACE``
  291. file sets, all of them must be specified with ``FILE_SET`` arguments. All
  292. ``PUBLIC`` or ``INTERFACE`` file sets associated with a target are included
  293. in the export.
  294. ``INCLUDES DESTINATION``
  295. This option specifies a list of directories which will be added to the
  296. :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target property of the
  297. ``<targets>`` when exported by the `install(EXPORT)`_ command. If a
  298. relative path is specified, it is treated as relative to the
  299. ``$<INSTALL_PREFIX>``.
  300. ``RUNTIME_DEPENDENCY_SET``
  301. .. versionadded:: 3.21
  302. This option causes all runtime dependencies of installed executable, shared
  303. library, and module targets to be added to the specified runtime dependency
  304. set. This set can then be installed with an
  305. `install(RUNTIME_DEPENDENCY_SET)`_ command.
  306. This keyword and the ``RUNTIME_DEPENDENCIES`` keyword are mutually
  307. exclusive.
  308. ``RUNTIME_DEPENDENCIES``
  309. .. versionadded:: 3.21
  310. This option causes all runtime dependencies of installed executable, shared
  311. library, and module targets to be installed along with the targets
  312. themselves. The ``RUNTIME``, ``LIBRARY``, ``FRAMEWORK``, and generic
  313. arguments are used to determine the properties (``DESTINATION``,
  314. ``COMPONENT``, etc.) of the installation of these dependencies.
  315. ``RUNTIME_DEPENDENCIES`` is semantically equivalent to the following pair
  316. of calls:
  317. .. code-block:: cmake
  318. install(TARGETS ... RUNTIME_DEPENDENCY_SET <set-name>)
  319. install(RUNTIME_DEPENDENCY_SET <set-name> args...)
  320. where ``<set-name>`` will be a randomly generated set name.
  321. The ``args...`` may include any of the following keywords supported by
  322. the `install(RUNTIME_DEPENDENCY_SET)`_ command:
  323. * ``DIRECTORIES``
  324. * ``PRE_INCLUDE_REGEXES``
  325. * ``PRE_EXCLUDE_REGEXES``
  326. * ``POST_INCLUDE_REGEXES``
  327. * ``POST_EXCLUDE_REGEXES``
  328. * ``POST_INCLUDE_FILES``
  329. * ``POST_EXCLUDE_FILES``
  330. The ``RUNTIME_DEPENDENCIES`` and ``RUNTIME_DEPENDENCY_SET`` keywords are
  331. mutually exclusive.
  332. One or more groups of properties may be specified in a single call to
  333. the ``TARGETS`` form of this command. A target may be installed more than
  334. once to different locations. Consider hypothetical targets ``myExe``,
  335. ``mySharedLib``, and ``myStaticLib``. The code:
  336. .. code-block:: cmake
  337. install(TARGETS myExe mySharedLib myStaticLib
  338. RUNTIME DESTINATION bin
  339. LIBRARY DESTINATION lib
  340. ARCHIVE DESTINATION lib/static)
  341. install(TARGETS mySharedLib DESTINATION /some/full/path)
  342. will install ``myExe`` to ``<prefix>/bin`` and ``myStaticLib`` to
  343. ``<prefix>/lib/static``. On non-DLL platforms ``mySharedLib`` will be
  344. installed to ``<prefix>/lib`` and ``/some/full/path``. On DLL platforms
  345. the ``mySharedLib`` DLL will be installed to ``<prefix>/bin`` and
  346. ``/some/full/path`` and its import library will be installed to
  347. ``<prefix>/lib/static`` and ``/some/full/path``.
  348. :ref:`Interface Libraries` may be listed among the targets to install.
  349. They install no artifacts but will be included in an associated ``EXPORT``.
  350. If :ref:`Object Libraries` are listed but given no destination for their
  351. object files, they will be exported as :ref:`Interface Libraries`.
  352. This is sufficient to satisfy transitive usage requirements of other
  353. targets that link to the object libraries in their implementation.
  354. Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property
  355. set to ``TRUE`` has undefined behavior.
  356. .. versionadded:: 3.3
  357. An install destination given as a ``DESTINATION`` argument may
  358. use "generator expressions" with the syntax ``$<...>``. See the
  359. :manual:`cmake-generator-expressions(7)` manual for available expressions.
  360. .. versionadded:: 3.13
  361. `install(TARGETS)`_ can install targets that were created in
  362. other directories. When using such cross-directory install rules, running
  363. ``make install`` (or similar) from a subdirectory will not guarantee that
  364. targets from other directories are up-to-date. You can use
  365. :command:`target_link_libraries` or :command:`add_dependencies`
  366. to ensure that such out-of-directory targets are built before the
  367. subdirectory-specific install rules are run.
  368. Installing Imported Runtime Artifacts
  369. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  370. .. _`install(IMPORTED_RUNTIME_ARTIFACTS)`:
  371. .. _IMPORTED_RUNTIME_ARTIFACTS:
  372. .. versionadded:: 3.21
  373. .. code-block:: cmake
  374. install(IMPORTED_RUNTIME_ARTIFACTS targets...
  375. [RUNTIME_DEPENDENCY_SET <set-name>]
  376. [[LIBRARY|RUNTIME|FRAMEWORK|BUNDLE]
  377. [DESTINATION <dir>]
  378. [PERMISSIONS permissions...]
  379. [CONFIGURATIONS [Debug|Release|...]]
  380. [COMPONENT <component>]
  381. [OPTIONAL] [EXCLUDE_FROM_ALL]
  382. ] [...]
  383. )
  384. The ``IMPORTED_RUNTIME_ARTIFACTS`` form specifies rules for installing the
  385. runtime artifacts of imported targets. Projects may do this if they want to
  386. bundle outside executables or modules inside their installation. The
  387. ``LIBRARY``, ``RUNTIME``, ``FRAMEWORK``, and ``BUNDLE`` arguments have the
  388. same semantics that they do in the `TARGETS`_ mode. Only the runtime artifacts
  389. of imported targets are installed (except in the case of :prop_tgt:`FRAMEWORK`
  390. libraries, :prop_tgt:`MACOSX_BUNDLE` executables, and :prop_tgt:`BUNDLE`
  391. CFBundles.) For example, headers and import libraries associated with DLLs are
  392. not installed. In the case of :prop_tgt:`FRAMEWORK` libraries,
  393. :prop_tgt:`MACOSX_BUNDLE` executables, and :prop_tgt:`BUNDLE` CFBundles, the
  394. entire directory is installed.
  395. The ``RUNTIME_DEPENDENCY_SET`` option causes the runtime artifacts of the
  396. imported executable, shared library, and module library ``targets`` to be
  397. added to the ``<set-name>`` runtime dependency set. This set can then be
  398. installed with an `install(RUNTIME_DEPENDENCY_SET)`_ command.
  399. Installing Files
  400. ^^^^^^^^^^^^^^^^
  401. .. _`install(FILES)`:
  402. .. _`install(PROGRAMS)`:
  403. .. _FILES:
  404. .. _PROGRAMS:
  405. .. note::
  406. If installing header files, consider using file sets defined by
  407. :command:`target_sources(FILE_SET)` instead. File sets associate
  408. headers with a target and they install as part of the target.
  409. .. code-block:: cmake
  410. install(<FILES|PROGRAMS> files...
  411. TYPE <type> | DESTINATION <dir>
  412. [PERMISSIONS permissions...]
  413. [CONFIGURATIONS [Debug|Release|...]]
  414. [COMPONENT <component>]
  415. [RENAME <name>] [OPTIONAL] [EXCLUDE_FROM_ALL])
  416. The ``FILES`` form specifies rules for installing files for a project.
  417. File names given as relative paths are interpreted with respect to the
  418. current source directory. Files installed by this form are by default
  419. given permissions ``OWNER_WRITE``, ``OWNER_READ``, ``GROUP_READ``, and
  420. ``WORLD_READ`` if no ``PERMISSIONS`` argument is given.
  421. The ``PROGRAMS`` form is identical to the ``FILES`` form except that the
  422. default permissions for the installed file also include ``OWNER_EXECUTE``,
  423. ``GROUP_EXECUTE``, and ``WORLD_EXECUTE``. This form is intended to install
  424. programs that are not targets, such as shell scripts. Use the ``TARGETS``
  425. form to install targets built within the project.
  426. The list of ``files...`` given to ``FILES`` or ``PROGRAMS`` may use
  427. "generator expressions" with the syntax ``$<...>``. See the
  428. :manual:`cmake-generator-expressions(7)` manual for available expressions.
  429. However, if any item begins in a generator expression it must evaluate
  430. to a full path.
  431. Either a ``TYPE`` or a ``DESTINATION`` must be provided, but not both.
  432. A ``TYPE`` argument specifies the generic file type of the files being
  433. installed. A destination will then be set automatically by taking the
  434. corresponding variable from :module:`GNUInstallDirs`, or by using a
  435. built-in default if that variable is not defined. See the table below for
  436. the supported file types and their corresponding variables and built-in
  437. defaults. Projects can provide a ``DESTINATION`` argument instead of a
  438. file type if they wish to explicitly define the install destination.
  439. ======================= ================================== =========================
  440. ``TYPE`` Argument GNUInstallDirs Variable Built-In Default
  441. ======================= ================================== =========================
  442. ``BIN`` ``${CMAKE_INSTALL_BINDIR}`` ``bin``
  443. ``SBIN`` ``${CMAKE_INSTALL_SBINDIR}`` ``sbin``
  444. ``LIB`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
  445. ``INCLUDE`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
  446. ``SYSCONF`` ``${CMAKE_INSTALL_SYSCONFDIR}`` ``etc``
  447. ``SHAREDSTATE`` ``${CMAKE_INSTALL_SHARESTATEDIR}`` ``com``
  448. ``LOCALSTATE`` ``${CMAKE_INSTALL_LOCALSTATEDIR}`` ``var``
  449. ``RUNSTATE`` ``${CMAKE_INSTALL_RUNSTATEDIR}`` ``<LOCALSTATE dir>/run``
  450. ``DATA`` ``${CMAKE_INSTALL_DATADIR}`` ``<DATAROOT dir>``
  451. ``INFO`` ``${CMAKE_INSTALL_INFODIR}`` ``<DATAROOT dir>/info``
  452. ``LOCALE`` ``${CMAKE_INSTALL_LOCALEDIR}`` ``<DATAROOT dir>/locale``
  453. ``MAN`` ``${CMAKE_INSTALL_MANDIR}`` ``<DATAROOT dir>/man``
  454. ``DOC`` ``${CMAKE_INSTALL_DOCDIR}`` ``<DATAROOT dir>/doc``
  455. ======================= ================================== =========================
  456. Projects wishing to follow the common practice of installing headers into a
  457. project-specific subdirectory will need to provide a destination rather than
  458. rely on the above. Using file sets for headers instead of ``install(FILES)``
  459. would be even better (see :command:`target_sources(FILE_SET)`).
  460. Note that some of the types' built-in defaults use the ``DATAROOT`` directory as
  461. a prefix. The ``DATAROOT`` prefix is calculated similarly to the types, with
  462. ``CMAKE_INSTALL_DATAROOTDIR`` as the variable and ``share`` as the built-in
  463. default. You cannot use ``DATAROOT`` as a ``TYPE`` parameter; please use
  464. ``DATA`` instead.
  465. To make packages compliant with distribution filesystem layout policies, if
  466. projects must specify a ``DESTINATION``, it is recommended that they use a
  467. path that begins with the appropriate :module:`GNUInstallDirs` variable.
  468. This allows package maintainers to control the install destination by setting
  469. the appropriate cache variables. The following example shows how to follow
  470. this advice while installing an image to a project-specific documentation
  471. subdirectory:
  472. .. code-block:: cmake
  473. include(GNUInstallDirs)
  474. install(FILES logo.png
  475. DESTINATION ${CMAKE_INSTALL_DOCDIR}/myproj
  476. )
  477. .. versionadded:: 3.4
  478. An install destination given as a ``DESTINATION`` argument may
  479. use "generator expressions" with the syntax ``$<...>``. See the
  480. :manual:`cmake-generator-expressions(7)` manual for available expressions.
  481. .. versionadded:: 3.20
  482. An install rename given as a ``RENAME`` argument may
  483. use "generator expressions" with the syntax ``$<...>``. See the
  484. :manual:`cmake-generator-expressions(7)` manual for available expressions.
  485. Installing Directories
  486. ^^^^^^^^^^^^^^^^^^^^^^
  487. .. _`install(DIRECTORY)`:
  488. .. _DIRECTORY:
  489. .. note::
  490. To install a directory sub-tree of headers, consider using file sets
  491. defined by :command:`target_sources(FILE_SET)` instead. File sets not only
  492. preserve directory structure, they also associate headers with a target
  493. and install as part of the target.
  494. .. code-block:: cmake
  495. install(DIRECTORY dirs...
  496. TYPE <type> | DESTINATION <dir>
  497. [FILE_PERMISSIONS permissions...]
  498. [DIRECTORY_PERMISSIONS permissions...]
  499. [USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER]
  500. [CONFIGURATIONS [Debug|Release|...]]
  501. [COMPONENT <component>] [EXCLUDE_FROM_ALL]
  502. [FILES_MATCHING]
  503. [[PATTERN <pattern> | REGEX <regex>]
  504. [EXCLUDE] [PERMISSIONS permissions...]] [...])
  505. The ``DIRECTORY`` form installs contents of one or more directories to a
  506. given destination. The directory structure is copied verbatim to the
  507. destination. The last component of each directory name is appended to
  508. the destination directory but a trailing slash may be used to avoid
  509. this because it leaves the last component empty. Directory names
  510. given as relative paths are interpreted with respect to the current
  511. source directory. If no input directory names are given the
  512. destination directory will be created but nothing will be installed
  513. into it. The ``FILE_PERMISSIONS`` and ``DIRECTORY_PERMISSIONS`` options
  514. specify permissions given to files and directories in the destination.
  515. If ``USE_SOURCE_PERMISSIONS`` is specified and ``FILE_PERMISSIONS`` is not,
  516. file permissions will be copied from the source directory structure.
  517. If no permissions are specified files will be given the default
  518. permissions specified in the ``FILES`` form of the command, and the
  519. directories will be given the default permissions specified in the
  520. ``PROGRAMS`` form of the command.
  521. .. versionadded:: 3.1
  522. The ``MESSAGE_NEVER`` option disables file installation status output.
  523. Installation of directories may be controlled with fine granularity
  524. using the ``PATTERN`` or ``REGEX`` options. These "match" options specify a
  525. globbing pattern or regular expression to match directories or files
  526. encountered within input directories. They may be used to apply
  527. certain options (see below) to a subset of the files and directories
  528. encountered. The full path to each input file or directory (with
  529. forward slashes) is matched against the expression. A ``PATTERN`` will
  530. match only complete file names: the portion of the full path matching
  531. the pattern must occur at the end of the file name and be preceded by
  532. a slash. A ``REGEX`` will match any portion of the full path but it may
  533. use ``/`` and ``$`` to simulate the ``PATTERN`` behavior. By default all
  534. files and directories are installed whether or not they are matched.
  535. The ``FILES_MATCHING`` option may be given before the first match option
  536. to disable installation of files (but not directories) not matched by
  537. any expression. For example, the code
  538. .. code-block:: cmake
  539. install(DIRECTORY src/ DESTINATION doc/myproj
  540. FILES_MATCHING PATTERN "*.png")
  541. will extract and install images from a source tree.
  542. Some options may follow a ``PATTERN`` or ``REGEX`` expression as described
  543. under :ref:`string(REGEX) <Regex Specification>` and are applied
  544. only to files or directories matching them. The ``EXCLUDE`` option will
  545. skip the matched file or directory. The ``PERMISSIONS`` option overrides
  546. the permissions setting for the matched file or directory. For
  547. example the code
  548. .. code-block:: cmake
  549. install(DIRECTORY icons scripts/ DESTINATION share/myproj
  550. PATTERN "CVS" EXCLUDE
  551. PATTERN "scripts/*"
  552. PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
  553. GROUP_EXECUTE GROUP_READ)
  554. will install the ``icons`` directory to ``share/myproj/icons`` and the
  555. ``scripts`` directory to ``share/myproj``. The icons will get default
  556. file permissions, the scripts will be given specific permissions, and any
  557. ``CVS`` directories will be excluded.
  558. Either a ``TYPE`` or a ``DESTINATION`` must be provided, but not both.
  559. A ``TYPE`` argument specifies the generic file type of the files within the
  560. listed directories being installed. A destination will then be set
  561. automatically by taking the corresponding variable from
  562. :module:`GNUInstallDirs`, or by using a built-in default if that variable
  563. is not defined. See the table below for the supported file types and their
  564. corresponding variables and built-in defaults. Projects can provide a
  565. ``DESTINATION`` argument instead of a file type if they wish to explicitly
  566. define the install destination.
  567. ======================= ================================== =========================
  568. ``TYPE`` Argument GNUInstallDirs Variable Built-In Default
  569. ======================= ================================== =========================
  570. ``BIN`` ``${CMAKE_INSTALL_BINDIR}`` ``bin``
  571. ``SBIN`` ``${CMAKE_INSTALL_SBINDIR}`` ``sbin``
  572. ``LIB`` ``${CMAKE_INSTALL_LIBDIR}`` ``lib``
  573. ``INCLUDE`` ``${CMAKE_INSTALL_INCLUDEDIR}`` ``include``
  574. ``SYSCONF`` ``${CMAKE_INSTALL_SYSCONFDIR}`` ``etc``
  575. ``SHAREDSTATE`` ``${CMAKE_INSTALL_SHARESTATEDIR}`` ``com``
  576. ``LOCALSTATE`` ``${CMAKE_INSTALL_LOCALSTATEDIR}`` ``var``
  577. ``RUNSTATE`` ``${CMAKE_INSTALL_RUNSTATEDIR}`` ``<LOCALSTATE dir>/run``
  578. ``DATA`` ``${CMAKE_INSTALL_DATADIR}`` ``<DATAROOT dir>``
  579. ``INFO`` ``${CMAKE_INSTALL_INFODIR}`` ``<DATAROOT dir>/info``
  580. ``LOCALE`` ``${CMAKE_INSTALL_LOCALEDIR}`` ``<DATAROOT dir>/locale``
  581. ``MAN`` ``${CMAKE_INSTALL_MANDIR}`` ``<DATAROOT dir>/man``
  582. ``DOC`` ``${CMAKE_INSTALL_DOCDIR}`` ``<DATAROOT dir>/doc``
  583. ======================= ================================== =========================
  584. Note that some of the types' built-in defaults use the ``DATAROOT`` directory as
  585. a prefix. The ``DATAROOT`` prefix is calculated similarly to the types, with
  586. ``CMAKE_INSTALL_DATAROOTDIR`` as the variable and ``share`` as the built-in
  587. default. You cannot use ``DATAROOT`` as a ``TYPE`` parameter; please use
  588. ``DATA`` instead.
  589. To make packages compliant with distribution filesystem layout policies, if
  590. projects must specify a ``DESTINATION``, it is recommended that they use a
  591. path that begins with the appropriate :module:`GNUInstallDirs` variable.
  592. This allows package maintainers to control the install destination by setting
  593. the appropriate cache variables.
  594. .. versionadded:: 3.4
  595. An install destination given as a ``DESTINATION`` argument may
  596. use "generator expressions" with the syntax ``$<...>``. See the
  597. :manual:`cmake-generator-expressions(7)` manual for available expressions.
  598. .. versionadded:: 3.5
  599. The list of ``dirs...`` given to ``DIRECTORY`` may use
  600. "generator expressions" too.
  601. Custom Installation Logic
  602. ^^^^^^^^^^^^^^^^^^^^^^^^^
  603. .. _`install(CODE)`:
  604. .. _`install(SCRIPT)`:
  605. .. _CODE:
  606. .. _SCRIPT:
  607. .. code-block:: cmake
  608. install([[SCRIPT <file>] [CODE <code>]]
  609. [ALL_COMPONENTS | COMPONENT <component>]
  610. [EXCLUDE_FROM_ALL] [...])
  611. The ``SCRIPT`` form will invoke the given CMake script files during
  612. installation. If the script file name is a relative path it will be
  613. interpreted with respect to the current source directory. The ``CODE``
  614. form will invoke the given CMake code during installation. Code is
  615. specified as a single argument inside a double-quoted string. For
  616. example, the code
  617. .. code-block:: cmake
  618. install(CODE "MESSAGE(\"Sample install message.\")")
  619. will print a message during installation.
  620. .. versionadded:: 3.21
  621. When the ``ALL_COMPONENTS`` option is given, the custom installation
  622. script code will be executed for every component of a component-specific
  623. installation. This option is mutually exclusive with the ``COMPONENT``
  624. option.
  625. .. versionadded:: 3.14
  626. ``<file>`` or ``<code>`` may use "generator expressions" with the syntax
  627. ``$<...>`` (in the case of ``<file>``, this refers to their use in the file
  628. name, not the file's contents). See the
  629. :manual:`cmake-generator-expressions(7)` manual for available expressions.
  630. Installing Exports
  631. ^^^^^^^^^^^^^^^^^^
  632. .. _`install(EXPORT)`:
  633. .. _EXPORT:
  634. .. code-block:: cmake
  635. install(EXPORT <export-name> DESTINATION <dir>
  636. [NAMESPACE <namespace>] [FILE <name>.cmake]
  637. [PERMISSIONS permissions...]
  638. [CONFIGURATIONS [Debug|Release|...]
  639. [CXX_MODULES_DIRECTORY <directory>]
  640. [EXPORT_LINK_INTERFACE_LIBRARIES]
  641. [COMPONENT <component>]
  642. [EXCLUDE_FROM_ALL])
  643. install(EXPORT_ANDROID_MK <export-name> DESTINATION <dir> [...])
  644. The ``EXPORT`` form generates and installs a CMake file containing code to
  645. import targets from the installation tree into another project.
  646. Target installations are associated with the export ``<export-name>``
  647. using the ``EXPORT`` option of the `install(TARGETS)`_ signature
  648. documented above. The ``NAMESPACE`` option will prepend ``<namespace>`` to
  649. the target names as they are written to the import file. By default
  650. the generated file will be called ``<export-name>.cmake`` but the ``FILE``
  651. option may be used to specify a different name. The value given to
  652. the ``FILE`` option must be a file name with the ``.cmake`` extension.
  653. If a ``CONFIGURATIONS`` option is given then the file will only be installed
  654. when one of the named configurations is installed. Additionally, the
  655. generated import file will reference only the matching target
  656. configurations. The ``EXPORT_LINK_INTERFACE_LIBRARIES`` keyword, if
  657. present, causes the contents of the properties matching
  658. ``(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?`` to be exported, when
  659. policy :policy:`CMP0022` is ``NEW``.
  660. .. note::
  661. The installed ``<export-name>.cmake`` file may come with additional
  662. per-configuration ``<export-name>-*.cmake`` files to be loaded by
  663. globbing. Do not use an export name that is the same as the package
  664. name in combination with installing a ``<package-name>-config.cmake``
  665. file or the latter may be incorrectly matched by the glob and loaded.
  666. When a ``COMPONENT`` option is given, the listed ``<component>`` implicitly
  667. depends on all components mentioned in the export set. The exported
  668. ``<name>.cmake`` file will require each of the exported components to be
  669. present in order for dependent projects to build properly. For example, a
  670. project may define components ``Runtime`` and ``Development``, with shared
  671. libraries going into the ``Runtime`` component and static libraries and
  672. headers going into the ``Development`` component. The export set would also
  673. typically be part of the ``Development`` component, but it would export
  674. targets from both the ``Runtime`` and ``Development`` components. Therefore,
  675. the ``Runtime`` component would need to be installed if the ``Development``
  676. component was installed, but not vice versa. If the ``Development`` component
  677. was installed without the ``Runtime`` component, dependent projects that try
  678. to link against it would have build errors. Package managers, such as APT and
  679. RPM, typically handle this by listing the ``Runtime`` component as a dependency
  680. of the ``Development`` component in the package metadata, ensuring that the
  681. library is always installed if the headers and CMake export file are present.
  682. .. versionadded:: 3.7
  683. In addition to cmake language files, the ``EXPORT_ANDROID_MK`` mode may be
  684. used to specify an export to the android ndk build system. This mode
  685. accepts the same options as the normal export mode. The Android
  686. NDK supports the use of prebuilt libraries, both static and shared. This
  687. allows cmake to build the libraries of a project and make them available
  688. to an ndk build system complete with transitive dependencies, include flags
  689. and defines required to use the libraries.
  690. ``CXX_MODULES_DIRECTORY``
  691. .. note ::
  692. Experimental. Gated by ``CMAKE_EXPERIMENTAL_CXX_MODULE_CMAKE_API``
  693. Specify a subdirectory to store C++ module information for targets in the
  694. export set. This directory will be populated with files which add the
  695. necessary target property information to the relevant targets. Note that
  696. without this information, none of the C++ modules which are part of the
  697. targets in the export set will support being imported in consuming targets.
  698. The ``EXPORT`` form is useful to help outside projects use targets built
  699. and installed by the current project. For example, the code
  700. .. code-block:: cmake
  701. install(TARGETS myexe EXPORT myproj DESTINATION bin)
  702. install(EXPORT myproj NAMESPACE mp_ DESTINATION lib/myproj)
  703. install(EXPORT_ANDROID_MK myproj DESTINATION share/ndk-modules)
  704. will install the executable ``myexe`` to ``<prefix>/bin`` and code to import
  705. it in the file ``<prefix>/lib/myproj/myproj.cmake`` and
  706. ``<prefix>/share/ndk-modules/Android.mk``. An outside project
  707. may load this file with the include command and reference the ``myexe``
  708. executable from the installation tree using the imported target name
  709. ``mp_myexe`` as if the target were built in its own tree.
  710. .. note::
  711. This command supersedes the :command:`install_targets` command and
  712. the :prop_tgt:`PRE_INSTALL_SCRIPT` and :prop_tgt:`POST_INSTALL_SCRIPT`
  713. target properties. It also replaces the ``FILES`` forms of the
  714. :command:`install_files` and :command:`install_programs` commands.
  715. The processing order of these install rules relative to
  716. those generated by :command:`install_targets`,
  717. :command:`install_files`, and :command:`install_programs` commands
  718. is not defined.
  719. Installing Runtime Dependencies
  720. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  721. .. _`install(RUNTIME_DEPENDENCY_SET)`:
  722. .. _RUNTIME_DEPENDENCY_SET:
  723. .. versionadded:: 3.21
  724. .. code-block:: cmake
  725. install(RUNTIME_DEPENDENCY_SET <set-name>
  726. [[LIBRARY|RUNTIME|FRAMEWORK]
  727. [DESTINATION <dir>]
  728. [PERMISSIONS permissions...]
  729. [CONFIGURATIONS [Debug|Release|...]]
  730. [COMPONENT <component>]
  731. [NAMELINK_COMPONENT <component>]
  732. [OPTIONAL] [EXCLUDE_FROM_ALL]
  733. ] [...]
  734. [PRE_INCLUDE_REGEXES regexes...]
  735. [PRE_EXCLUDE_REGEXES regexes...]
  736. [POST_INCLUDE_REGEXES regexes...]
  737. [POST_EXCLUDE_REGEXES regexes...]
  738. [POST_INCLUDE_FILES files...]
  739. [POST_EXCLUDE_FILES files...]
  740. [DIRECTORIES directories...]
  741. )
  742. Installs a runtime dependency set previously created by one or more
  743. `install(TARGETS)`_ or `install(IMPORTED_RUNTIME_ARTIFACTS)`_ commands. The
  744. dependencies of targets belonging to a runtime dependency set are installed in
  745. the ``RUNTIME`` destination and component on DLL platforms, and in the
  746. ``LIBRARY`` destination and component on non-DLL platforms. macOS frameworks
  747. are installed in the ``FRAMEWORK`` destination and component.
  748. Targets built within the build tree will never be installed as runtime
  749. dependencies, nor will their own dependencies, unless the targets themselves
  750. are installed with `install(TARGETS)`_.
  751. The generated install script calls :command:`file(GET_RUNTIME_DEPENDENCIES)`
  752. on the build-tree files to calculate the runtime dependencies. The build-tree
  753. executable files are passed as the ``EXECUTABLES`` argument, the build-tree
  754. shared libraries as the ``LIBRARIES`` argument, and the build-tree modules as
  755. the ``MODULES`` argument. On macOS, if one of the executables is a
  756. :prop_tgt:`MACOSX_BUNDLE`, that executable is passed as the
  757. ``BUNDLE_EXECUTABLE`` argument. At most one such bundle executable may be in
  758. the runtime dependency set on macOS. The :prop_tgt:`MACOSX_BUNDLE` property
  759. has no effect on other platforms. Note that
  760. :command:`file(GET_RUNTIME_DEPENDENCIES)` only supports collecting the runtime
  761. dependencies for Windows, Linux and macOS platforms, so
  762. ``install(RUNTIME_DEPENDENCY_SET)`` has the same limitation.
  763. The following sub-arguments are forwarded through as the corresponding
  764. arguments to :command:`file(GET_RUNTIME_DEPENDENCIES)` (for those that provide
  765. a non-empty list of directories, regular expressions or files). They all
  766. support :manual:`generator expressions <cmake-generator-expressions(7)>`.
  767. * ``DIRECTORIES <directories>``
  768. * ``PRE_INCLUDE_REGEXES <regexes>``
  769. * ``PRE_EXCLUDE_REGEXES <regexes>``
  770. * ``POST_INCLUDE_REGEXES <regexes>``
  771. * ``POST_EXCLUDE_REGEXES <regexes>``
  772. * ``POST_INCLUDE_FILES <files>``
  773. * ``POST_EXCLUDE_FILES <files>``
  774. Generated Installation Script
  775. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  776. .. note::
  777. Use of this feature is not recommended. Please consider using the
  778. ``--install`` argument of :manual:`cmake(1)` instead.
  779. The ``install()`` command generates a file, ``cmake_install.cmake``, inside
  780. the build directory, which is used internally by the generated install target
  781. and by CPack. You can also invoke this script manually with ``cmake -P``. This
  782. script accepts several variables:
  783. ``COMPONENT``
  784. Set this variable to install only a single CPack component as opposed to all
  785. of them. For example, if you only want to install the ``Development``
  786. component, run ``cmake -DCOMPONENT=Development -P cmake_install.cmake``.
  787. ``BUILD_TYPE``
  788. Set this variable to change the build type if you are using a multi-config
  789. generator. For example, to install with the ``Debug`` configuration, run
  790. ``cmake -DBUILD_TYPE=Debug -P cmake_install.cmake``.
  791. ``DESTDIR``
  792. This is an environment variable rather than a CMake variable. It allows you
  793. to change the installation prefix on UNIX systems. See :envvar:`DESTDIR` for
  794. details.