Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Help / envvar / DESTDIR.rst
1 DESTDIR
2 -------
3
4 .. include:: ENV_VAR.txt
5
6 On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the
7 whole installation.  ``DESTDIR`` means DESTination DIRectory.  It is
8 commonly used by packagers to install software in a staging directory.
9
10 For example, running
11
12 .. code-block:: shell
13
14   make DESTDIR=/package/stage install
15
16 will install the software using the installation prefix, e.g. ``/usr/local``,
17 prepended with the ``DESTDIR`` value which gives ``/package/stage/usr/local``.
18 The packaging tool may then construct the package from the content of the
19 ``/package/stage`` directory.
20
21 See the :variable:`CMAKE_INSTALL_PREFIX` variable to control the
22 installation prefix when configuring a build tree.  Or, when using
23 the :manual:`cmake(1)` command-line tool's :option:`--install <cmake --install>`
24 mode, one may specify a different prefix using the
25 :option:`--prefix <cmake--install --prefix>` option.
26
27 .. note::
28
29   ``DESTDIR`` may not be used on Windows because installation
30   prefix usually contains a drive letter like in ``C:/Program Files``
31   which cannot be prepended with some other prefix.