Help: Document the $CACHE{} syntax

Also add a test case for the behavior.
This commit is contained in:
Robert Maynard
2018-08-07 08:43:22 -04:00
committed by Brad King
parent 90df5f6730
commit 4d384d290e
7 changed files with 40 additions and 3 deletions

View File

@@ -399,6 +399,11 @@ and how their values are set.
An *environment variable reference* has the form ``$ENV{VAR}`` and
is evaluated in the same contexts as a normal variable reference.
See :variable:`ENV` for more information.
A *cache variable reference* has the form ``$CACHE{VAR}`` and
is evaluated in the same contexts as a normal variable reference.
See :variable:`CACHE` for more information.
Comments
--------
@@ -543,6 +548,8 @@ to the binding in the current directory scope, if any. If a
is found, or no binding is found, CMake then searches for a
cache entry. If a cache entry is found, its value is used.
Otherwise, the variable reference evaluates to an empty string.
The ``$CACHE{VAR}`` syntax can be used to do direct cache entry
lookups.
The :manual:`cmake-variables(7)` manual documents many variables
that are provided by CMake or have meaning to CMake when set

View File

@@ -230,6 +230,7 @@ Variables that Describe the System
/variable/ANDROID
/variable/APPLE
/variable/BORLAND
/variable/CACHE
/variable/CMAKE_CL_64
/variable/CMAKE_COMPILER_2005
/variable/CMAKE_HOST_APPLE

17
Help/variable/CACHE.rst Normal file
View File

@@ -0,0 +1,17 @@
CACHE
-----
Read cache variables.
Use the syntax ``$CACHE{VAR}`` to read cache entry ``VAR``.
See the :ref:`cmake-language(7) variables <CMake Language Variables>`
documentation for more complete documentation of the interaction of
normal variables and cache entries.
When evaluating :ref:`Variable References` of the form ``${VAR}``,
CMake first searches for a normal variable with that name, and if not
found CMake will search for a cache entry with that name.
The ``$CACHE{VAR}`` syntax can be used to do direct cache lookup and
ignore any existing normal variable.
See the :command:`set` command to see how to write cache variables.

View File

@@ -1,7 +1,8 @@
ENV
---
Access environment variables.
Read environment variables.
Use the syntax ``$ENV{VAR}`` to read environment variable ``VAR``. See also
the :command:`set` command to set ``ENV{VAR}``.
Use the syntax ``$ENV{VAR}`` to read environment variable ``VAR``.
See the :command:`set` command to see how to write environment variables.