summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2018-06-21 18:53:11 (GMT)
committerBrad King <brad.king@kitware.com>2018-07-09 11:48:28 (GMT)
commit2a5f5c0e316d415e1b8207348b34761d34f191ae (patch)
treea17a979c357a3148424b71fc0bcac898b1ec7e4a /Help
parent12e6f83319d089b3295b4211d0d4810575e8f7d5 (diff)
downloadCMake-2a5f5c0e316d415e1b8207348b34761d34f191ae.zip
CMake-2a5f5c0e316d415e1b8207348b34761d34f191ae.tar.gz
CMake-2a5f5c0e316d415e1b8207348b34761d34f191ae.tar.bz2
option: respect existing normal variable
Add policy CMP0077 to change this behavior in a compatible way.
Diffstat (limited to 'Help')
-rw-r--r--Help/command/option.rst4
-rw-r--r--Help/manual/cmake-policies.7.rst1
-rw-r--r--Help/policy/CMP0077.rst16
-rw-r--r--Help/release/dev/option-normal-variable.rst5
4 files changed, 25 insertions, 1 deletions
diff --git a/Help/command/option.rst b/Help/command/option.rst
index 91cd0a7..4fabb87 100644
--- a/Help/command/option.rst
+++ b/Help/command/option.rst
@@ -9,7 +9,9 @@ Provides an option that the user can optionally select.
[initial value])
Provide an option for the user to select as ``ON`` or ``OFF``. If no
-initial value is provided, ``OFF`` is used.
+initial value is provided, ``OFF`` is used. If the option is already
+set as a normal variable then the command does nothing
+(see policy :policy:`CMP0077`).
If you have options that depend on the values of other options, see
the module help for :module:`CMakeDependentOption`.
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 6179a7c..b2eeb3a 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -57,6 +57,7 @@ Policies Introduced by CMake 3.13
.. toctree::
:maxdepth: 1
+ CMP0077: option() honors normal variables. </policy/CMP0077>
CMP0076: target_sources() command converts relative paths to absolute. </policy/CMP0076>
Policies Introduced by CMake 3.12
diff --git a/Help/policy/CMP0077.rst b/Help/policy/CMP0077.rst
new file mode 100644
index 0000000..8efe198
--- /dev/null
+++ b/Help/policy/CMP0077.rst
@@ -0,0 +1,16 @@
+CMP0077
+-------
+
+:command:`option` honors normal variables.
+
+The ``OLD`` behavior for this policy is to clear any existing normal variables
+with the same name. The ``NEW`` behavior for this policy is to not create
+a cache entry or modify any existing normal variables if a normal variable
+with the same name already exists.
+
+This policy was introduced in CMake version 3.13. CMake version
+|release| warns when the policy is not set and uses ``OLD`` behavior.
+Use the :command:`cmake_policy` command to set it to ``OLD`` or ``NEW``
+explicitly.
+
+.. include:: DEPRECATED.txt
diff --git a/Help/release/dev/option-normal-variable.rst b/Help/release/dev/option-normal-variable.rst
new file mode 100644
index 0000000..19b9a64
--- /dev/null
+++ b/Help/release/dev/option-normal-variable.rst
@@ -0,0 +1,5 @@
+option-normal-variable
+----------------------
+
+* The :command:`option` command now honors existing normal variables instead
+ of replacing them with a cache entry. See policy :policy:`CMP0077`.