diff options
author | Brad King <brad.king@kitware.com> | 2018-11-09 15:34:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-11-09 15:35:28 (GMT) |
commit | 9463d73cc4d58b190fac0cac6aeee424b5d29514 (patch) | |
tree | 3fffb6d268670021fd8e016ac9f22c69e6b433df /Help/command | |
parent | 8db4bd115c566460986ddd2f7a8f4f90ee5baf26 (diff) | |
parent | 860338491ee96274ac110459b3b316149d4585f7 (diff) | |
download | CMake-9463d73cc4d58b190fac0cac6aeee424b5d29514.zip CMake-9463d73cc4d58b190fac0cac6aeee424b5d29514.tar.gz CMake-9463d73cc4d58b190fac0cac6aeee424b5d29514.tar.bz2 |
Merge topic 'env'
860338491e Help: Describe $CACHE and $ENV as operators
e855bd5248 Help: Document if(DEFINED ENV{name})
8ba2a8d4a4 Help: short/long variable reference in if command
85498fccd8 Help: Provide backreferences.
e24ef96942 Help: New section on Environment Variables in cmake-language.7
e4554149c4 Help: Remove over-precise clause.
3de551cc22 Help: Clarify effect of set(ENV{..} ..) and unset(ENV{..})
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2538
Diffstat (limited to 'Help/command')
-rw-r--r-- | Help/command/if.rst | 16 | ||||
-rw-r--r-- | Help/command/set.rst | 8 | ||||
-rw-r--r-- | Help/command/unset.rst | 17 |
3 files changed, 31 insertions, 10 deletions
diff --git a/Help/command/if.rst b/Help/command/if.rst index 4781f35..1cd9965 100644 --- a/Help/command/if.rst +++ b/Help/command/if.rst @@ -187,10 +187,11 @@ Possible conditions are: ``if(<variable|string> IN_LIST <variable>)`` True if the given element is contained in the named list variable. -``if(DEFINED <variable>)`` - True if the given variable is defined. It does not matter if the - variable is true or false just if it has been set. (Note macro - arguments are not variables.) +``if(DEFINED <name>|ENV{<name>})`` + True if a variable or environment variable + with given ``<name>`` is defined. + The value of the variable does not matter. + Note that macro arguments are not variables. ``if((condition) AND (condition OR (condition)))`` The conditions inside the parenthesis are evaluated first and then @@ -231,7 +232,7 @@ which is true because ``var2`` is defined to "var1" which is not a false constant. Automatic evaluation applies in the other cases whenever the -above-documented signature accepts ``<variable|string>``: +above-documented condition syntax accepts ``<variable|string>``: * The left hand argument to ``MATCHES`` is first checked to see if it is a defined variable, if so the variable's value is used, otherwise the @@ -269,3 +270,8 @@ specified in a :ref:`Quoted Argument` or a :ref:`Bracket Argument`. A quoted or bracketed variable or keyword will be interpreted as a string and not dereferenced or interpreted. See policy :policy:`CMP0054`. + +There is no automatic evaluation for environment or cache +:ref:`Variable References`. Their values must be referenced as +``$ENV{<name>}`` or ``$CACHE{<name>}`` wherever the above-documented +condition syntax accepts ``<variable|string>``. diff --git a/Help/command/set.rst b/Help/command/set.rst index e37e693..dd5ea13 100644 --- a/Help/command/set.rst +++ b/Help/command/set.rst @@ -88,4 +88,10 @@ Set Environment Variable set(ENV{<variable>} <value>...) -Sets the current process environment ``<variable>`` to the given value. +Sets an :manual:`Environment Variable <cmake-env-variables(7)>` +to the given value. +Subsequent calls of ``$ENV{<variable>}`` will return this new value. + +This command affects only the current CMake process, not the process +from which CMake was called, nor the system environment at large, +nor the environment of subsequent build or test processes. diff --git a/Help/command/unset.rst b/Help/command/unset.rst index 1a5e49f..7521052 100644 --- a/Help/command/unset.rst +++ b/Help/command/unset.rst @@ -3,6 +3,9 @@ unset Unset a variable, cache variable, or environment variable. +Unset Normal Variable or Cache Entry +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + .. code-block:: cmake unset(<variable> [CACHE | PARENT_SCOPE]) @@ -22,11 +25,17 @@ If ``PARENT_SCOPE`` is present then the variable is removed from the scope above the current scope. See the same option in the :command:`set` command for further details. -``<variable>`` can be an environment variable such as: +Unset Environment Variable +^^^^^^^^^^^^^^^^^^^^^^^^^^ .. code-block:: cmake - unset(ENV{LD_LIBRARY_PATH}) + unset(ENV{<variable>}) + +Removes ``<variable>`` from the currently available +:manual:`Environment Variables <cmake-env-variables(7)>`. +Subsequent calls of ``$ENV{<variable>}`` will return the empty string. -in which case the variable will be removed from the current -environment. +This command affects only the current CMake process, not the process +from which CMake was called, nor the system environment at large, +nor the environment of subsequent build or test processes. |