cmake/Help/variable/CMAKE_INSTALL_PREFIX.rst

48 lines
1.6 KiB
ReStructuredText
Raw Normal View History

2014-08-03 19:52:23 +02:00
CMAKE_INSTALL_PREFIX
--------------------
2015-11-17 17:22:37 +01:00
Install directory used by :command:`install`.
2014-08-03 19:52:23 +02:00
2015-11-17 17:22:37 +01:00
If ``make install`` is invoked or ``INSTALL`` is built, this directory is
2024-04-14 22:45:38 +02:00
prepended onto all install directories.
This variable defaults as follows:
* .. versionadded:: 3.29
If the :envvar:`CMAKE_INSTALL_PREFIX` environment variable is set,
its value is used as default for this variable.
* ``c:/Program Files/${PROJECT_NAME}`` on Windows.
* ``/usr/local`` on UNIX platforms.
2016-12-03 23:28:24 +01:00
See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a
project might choose its own default.
2014-08-03 19:52:23 +02:00
2015-11-17 17:22:37 +01:00
On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the
2022-03-29 21:10:50 +02:00
whole installation to a staging area. See the :envvar:`DESTDIR` environment
variable for more information.
2014-08-03 19:52:23 +02:00
2015-11-17 17:22:37 +01:00
The installation prefix is also added to :variable:`CMAKE_SYSTEM_PREFIX_PATH`
so that :command:`find_package`, :command:`find_program`,
:command:`find_library`, :command:`find_path`, and :command:`find_file`
2022-03-29 21:10:50 +02:00
will search the prefix for other software. This behavior can be disabled by
setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` to ``TRUE`` before the
first :command:`project` invocation.
2015-04-27 22:25:09 +02:00
.. note::
Use the :module:`GNUInstallDirs` module to provide GNU-style
options for the layout of directories within the installation.
2022-03-29 21:10:50 +02:00
The ``CMAKE_INSTALL_PREFIX`` may be defined when configuring a build tree
to set its installation prefix. Or, when using the :manual:`cmake(1)`
2022-11-16 20:14:03 +01:00
command-line tool's :option:`--install <cmake --install>` mode, one may specify
a different prefix using the :option:`--prefix <cmake--install --prefix>`
option:
2022-03-29 21:10:50 +02:00
.. code-block:: shell
cmake --install . --prefix /my/install/prefix