summaryrefslogtreecommitdiffstats
path: root/Help/manual
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-08-18 12:52:54 (GMT)
committerBrad King <brad.king@kitware.com>2022-08-18 13:04:08 (GMT)
commit159acea39433ea23a327c1b1fc68347e82dfdd49 (patch)
treeae7c8f179b90d8ff1f5a1e4d950a765ae4c716ed /Help/manual
parentc3793b41573ee584e572ea546527b9350f46a05d (diff)
downloadCMake-159acea39433ea23a327c1b1fc68347e82dfdd49.zip
CMake-159acea39433ea23a327c1b1fc68347e82dfdd49.tar.gz
CMake-159acea39433ea23a327c1b1fc68347e82dfdd49.tar.bz2
Help: Clarify that variable references may use cache entries
Clarify in `cmake-language(7)` that a variable lookup may use a cache entry if the variable is not set. Fix misleading text in added by commit 8ba2a8d4a4 (Help: short/long variable reference in if command, 2018-11-01, v3.14.0-rc1~408^2~2). Fixes: #23863
Diffstat (limited to 'Help/manual')
-rw-r--r--Help/manual/cmake-language.7.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst
index 02cfa7e..16917ff 100644
--- a/Help/manual/cmake-language.7.rst
+++ b/Help/manual/cmake-language.7.rst
@@ -391,8 +391,8 @@ Variable References
A *variable reference* has the form ``${<variable>}`` and is
evaluated inside a `Quoted Argument`_ or an `Unquoted Argument`_.
-A variable reference is replaced by the value of the variable,
-or by the empty string if the variable is not set.
+A variable reference is replaced by the value of the specified
+variable or cache entry, or if neither is set, by the empty string.
Variable references can nest and are evaluated from the
inside out, e.g. ``${outer_${inner_variable}_variable}``.
@@ -408,14 +408,16 @@ and how their values are set.
An *environment variable reference* has the form ``$ENV{<variable>}``.
See the `Environment Variables`_ section for more information.
-A *cache variable reference* has the form ``$CACHE{<variable>}``.
+A *cache variable reference* has the form ``$CACHE{<variable>}``,
+and is replaced by the value of the specified cache entry without
+checking for a normal variable of the same name. If the cache
+entry does not exist, it is replaced by the empty string.
See :variable:`CACHE` for more information.
The :command:`if` command has a special condition syntax that
allows for variable references in the short form ``<variable>``
-instead of ``${<variable>}``.
-However, environment and cache variables always need to be
-referenced as ``$ENV{<variable>}`` or ``$CACHE{<variable>}``.
+instead of ``${<variable>}``. However, environment variables
+always need to be referenced as ``$ENV{<variable>}``.
Comments
--------