summaryrefslogtreecommitdiff
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-05 16:50:46 +0000
committerKitware Robot <kwrobot@kitware.com>2022-05-05 12:50:53 -0400
commit213f3917155ebe70b312c94cd8031bafa82c7215 (patch)
tree519c1687ec1424658552d3b65381abeeb3263496 /Help
parent7d78dcbebbb028c17de38e337942e0df061c6f20 (diff)
parenta693da21f3ac17ca6201b8b6cf4865295c0fe260 (diff)
downloadcmake-213f3917155ebe70b312c94cd8031bafa82c7215.tar.gz
Merge topic 'HelpEnv'
a693da21f3 Help: from command:if, link to environment variables ab2bdbaf31 Help: Cross-reference ENV operator from cmake-language(7) manual ee4e728a69 Help: From Environment Variables section, link to cmake -E env etc Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7239
Diffstat (limited to 'Help')
-rw-r--r--Help/command/if.rst5
-rw-r--r--Help/manual/cmake-language.7.rst10
-rw-r--r--Help/manual/cmake.1.rst2
-rw-r--r--Help/variable/ENV.rst5
4 files changed, 17 insertions, 5 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst
index 4f955db0e9..64f1c35586 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -71,8 +71,9 @@ Basic Expressions
True if given a variable that is defined to a value that is not a false
constant. False otherwise, including if the variable is undefined.
Note that macro arguments are not variables.
- Environment variables also cannot be tested this way, e.g.
- ``if(ENV{some_var})`` will always evaluate to false.
+ :ref:`Environment Variables <CMake Language Environment Variables>` also
+ cannot be tested this way, e.g. ``if(ENV{some_var})`` will always evaluate
+ to false.
``if(<string>)``
A quoted string always evaluates to false unless:
diff --git a/Help/manual/cmake-language.7.rst b/Help/manual/cmake-language.7.rst
index e7d2694e4e..02cfa7e5fa 100644
--- a/Help/manual/cmake-language.7.rst
+++ b/Help/manual/cmake-language.7.rst
@@ -582,7 +582,8 @@ Scope
They are never cached.
References
- `Variable References`_ have the form ``$ENV{<variable>}``.
+ `Variable References`_ have the form ``$ENV{<variable>}``, using the
+ :variable:`ENV` operator.
Initialization
Initial values of the CMake environment variables are those of
@@ -594,6 +595,13 @@ Initialization
Changed values are not written back to the calling process,
and they are not seen by subsequent build or test processes.
+ See the :ref:`cmake -E env <Run a Command-Line Tool>` command-line
+ tool to run a command in a modified environment.
+
+Inspection
+ See the :ref:`cmake -E environment <Run a Command-Line Tool>` command-line
+ tool to display all current environment variables.
+
The :manual:`cmake-env-variables(7)` manual documents environment
variables that have special meaning to CMake.
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 3ef7b3f4ce..3c5c46cdf3 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -619,6 +619,8 @@ in the set of :variable:`CMAKE_ARGV<n> <CMAKE_ARGV0>` variables passed to the
script (including the ``--`` itself).
+.. _`Run a Command-Line Tool`:
+
Run a Command-Line Tool
=======================
diff --git a/Help/variable/ENV.rst b/Help/variable/ENV.rst
index 2b439342ec..6791853bb6 100644
--- a/Help/variable/ENV.rst
+++ b/Help/variable/ENV.rst
@@ -8,5 +8,6 @@ Use the syntax ``$ENV{VAR}`` to read environment variable ``VAR``.
To test whether an environment variable is defined, use the signature
``if(DEFINED ENV{<name>})`` of the :command:`if` command.
-See the :command:`set` and :command:`unset` commands to see how to
-write or remove environment variables.
+For general information on environment variables, see the
+:ref:`Environment Variables <CMake Language Environment Variables>`
+section in the :manual:`cmake-language(7)` manual.