From 159acea39433ea23a327c1b1fc68347e82dfdd49 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 18 Aug 2022 08:52:54 -0400 Subject: 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 --- Help/manual/cmake-language.7.rst | 14 ++++++++------ 1 file 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 ``${}`` 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{}``. See the `Environment Variables`_ section for more information. -A *cache variable reference* has the form ``$CACHE{}``. +A *cache variable reference* has the form ``$CACHE{}``, +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 ```` -instead of ``${}``. -However, environment and cache variables always need to be -referenced as ``$ENV{}`` or ``$CACHE{}``. +instead of ``${}``. However, environment variables +always need to be referenced as ``$ENV{}``. Comments -------- -- cgit v0.12