6d42ea8f05df1557c4c78274fa0b6eac98e22f74
[platform/upstream/cmake.git] / Help / variable / CMAKE_INSTALL_PREFIX.rst
1 CMAKE_INSTALL_PREFIX
2 --------------------
3
4 Install directory used by :command:`install`.
5
6 If ``make install`` is invoked or ``INSTALL`` is built, this directory is
7 prepended onto all install directories.  This variable defaults to
8 ``/usr/local`` on UNIX and ``c:/Program Files/${PROJECT_NAME}`` on Windows.
9 See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a
10 project might choose its own default.
11
12 On UNIX one can use the ``DESTDIR`` mechanism in order to relocate the
13 whole installation to a staging area.  See the :envvar:`DESTDIR` environment
14 variable for more information.
15
16 The installation prefix is also added to :variable:`CMAKE_SYSTEM_PREFIX_PATH`
17 so that :command:`find_package`, :command:`find_program`,
18 :command:`find_library`, :command:`find_path`, and :command:`find_file`
19 will search the prefix for other software. This behavior can be disabled by
20 setting the :variable:`CMAKE_FIND_NO_INSTALL_PREFIX` to ``TRUE`` before the
21 first :command:`project` invocation.
22
23 .. note::
24
25   Use the :module:`GNUInstallDirs` module to provide GNU-style
26   options for the layout of directories within the installation.
27
28 The ``CMAKE_INSTALL_PREFIX`` may be defined when configuring a build tree
29 to set its installation prefix.  Or, when using the :manual:`cmake(1)`
30 command-line tool's ``--install`` mode, one may specify a different prefix
31 using the ``--prefix`` option:
32
33 .. code-block:: shell
34
35   cmake --install . --prefix /my/install/prefix