summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-05-17 13:43:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-05-17 13:43:24 (GMT)
commitea073907034ef928f573854ead30fa8684f40805 (patch)
tree40006f0a27ed4e74d82c72e4db3418b8ac94d022
parentafac27d488d618090945a7651e4d2a749d98fe9b (diff)
parentb00a171b2b07d1644eba5c34a8679c6bb368cda7 (diff)
downloadCMake-ea073907034ef928f573854ead30fa8684f40805.zip
CMake-ea073907034ef928f573854ead30fa8684f40805.tar.gz
CMake-ea073907034ef928f573854ead30fa8684f40805.tar.bz2
Merge topic 'doc-cmake_minimum_version'
b00a171b2b Help: Clarify calling cmake_minimum_required() inside a function Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6129
-rw-r--r--Help/command/cmake_minimum_required.rst9
-rw-r--r--Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst3
2 files changed, 9 insertions, 3 deletions
diff --git a/Help/command/cmake_minimum_required.rst b/Help/command/cmake_minimum_required.rst
index 2cc3cfe..d159770 100644
--- a/Help/command/cmake_minimum_required.rst
+++ b/Help/command/cmake_minimum_required.rst
@@ -40,8 +40,13 @@ with an error instead of just a warning.
they may affect. See also policy :policy:`CMP0000`.
Calling ``cmake_minimum_required()`` inside a :command:`function`
- limits some effects to the function scope when invoked. Such calls
- should not be made with the intention of having global effects.
+ limits some effects to the function scope when invoked. For example,
+ the :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` variable won't be set
+ in the calling scope. Functions do not introduce their own policy
+ scope though, so policy settings of the caller *will* be affected
+ (see below). Due to this mix of things that do and do not affect the
+ calling scope, calling ``cmake_minimum_required()`` inside a function
+ is generally discouraged.
.. _`Policy Settings`:
diff --git a/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst b/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst
index f466468..8d6b533 100644
--- a/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst
+++ b/Help/variable/CMAKE_MINIMUM_REQUIRED_VERSION.rst
@@ -2,4 +2,5 @@ CMAKE_MINIMUM_REQUIRED_VERSION
------------------------------
The ``<min>`` version of CMake given to the most recent call to the
-:command:`cmake_minimum_required(VERSION)` command.
+:command:`cmake_minimum_required(VERSION)` command in the current
+variable scope or any parent variable scope.