diff options
author | Brad King <brad.king@kitware.com> | 2023-08-19 12:43:33 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-08-19 12:43:41 (GMT) |
commit | e17f17c7a0824c4c8cbbd576032619c0d926c090 (patch) | |
tree | 74bccc8de2a6ca0835e2e40f48d3b93a7fdb867b /Help | |
parent | a891f7d0bf31817a83879b02f5f2a0fbf6913d6e (diff) | |
parent | a8634b878a071815989049ec814e6016087f96ce (diff) | |
download | CMake-e17f17c7a0824c4c8cbbd576032619c0d926c090.zip CMake-e17f17c7a0824c4c8cbbd576032619c0d926c090.tar.gz CMake-e17f17c7a0824c4c8cbbd576032619c0d926c090.tar.bz2 |
Merge topic 'doc_env'
a8634b878a Help:ENV: note escaping needed for special characters
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !8733
Diffstat (limited to 'Help')
-rw-r--r-- | Help/variable/ENV.rst | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Help/variable/ENV.rst b/Help/variable/ENV.rst index 6791853..71df3dd 100644 --- a/Help/variable/ENV.rst +++ b/Help/variable/ENV.rst @@ -8,6 +8,17 @@ 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. +.. note:: + + Environment variable names containing special characters like parentheses + may need to be escaped. (Policy :policy:`CMP0053` must also be enabled.) + For example, to get the value of the Windows environment variable + ``ProgramFiles(x86)``, use: + + .. code-block:: cmake + + set(ProgramFiles_x86 "$ENV{ProgramFiles\(x86\)}") + For general information on environment variables, see the :ref:`Environment Variables <CMake Language Environment Variables>` section in the :manual:`cmake-language(7)` manual. |