summaryrefslogtreecommitdiffstats
path: root/Help/variable
diff options
context:
space:
mode:
authorSilvio Traversaro <silvio@traversaro.it>2024-01-29 19:32:31 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-30 16:44:45 (GMT)
commit06af18b9db267926dfd8fd346328a64a41238aa3 (patch)
treeb042ca401e723dcae50ddafe04bf5629826d6cc8 /Help/variable
parentb0d8b857d8ae4afe83d05eaad451b628817b6dce (diff)
downloadCMake-06af18b9db267926dfd8fd346328a64a41238aa3.zip
CMake-06af18b9db267926dfd8fd346328a64a41238aa3.tar.gz
CMake-06af18b9db267926dfd8fd346328a64a41238aa3.tar.bz2
cmake: Allow CMAKE_INSTALL_PREFIX to be set by environment variable
Fixes: #25023
Diffstat (limited to 'Help/variable')
-rw-r--r--Help/variable/CMAKE_INSTALL_PREFIX.rst15
-rw-r--r--Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst7
2 files changed, 17 insertions, 5 deletions
diff --git a/Help/variable/CMAKE_INSTALL_PREFIX.rst b/Help/variable/CMAKE_INSTALL_PREFIX.rst
index c76727e..ce7cb8b 100644
--- a/Help/variable/CMAKE_INSTALL_PREFIX.rst
+++ b/Help/variable/CMAKE_INSTALL_PREFIX.rst
@@ -4,8 +4,19 @@ CMAKE_INSTALL_PREFIX
Install directory used by :command:`install`.
If ``make install`` is invoked or ``INSTALL`` is built, this directory is
-prepended onto all install directories. This variable defaults to
-``/usr/local`` on UNIX and ``c:/Program Files/${PROJECT_NAME}`` on Windows.
+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.
+
See :variable:`CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT` for how a
project might choose its own default.
diff --git a/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst b/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst
index 93cc319..316fea2 100644
--- a/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst
+++ b/Help/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.rst
@@ -5,9 +5,10 @@ CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
CMake sets this variable to a ``TRUE`` value when the
:variable:`CMAKE_INSTALL_PREFIX` has just been initialized to
-its default value, typically on the first run of CMake within
-a new build tree. This can be used by project code to change
-the default without overriding a user-provided value:
+its default value, typically on the first
+run of CMake within a new build tree and the :envvar:`CMAKE_INSTALL_PREFIX`
+environment variable is not set on the first run of CMake. This can be used
+by project code to change the default without overriding a user-provided value:
.. code-block:: cmake