diff options
author | scivision <scivision@users.noreply.github.com> | 2023-08-17 13:57:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-08-17 14:51:14 (GMT) |
commit | a8634b878a071815989049ec814e6016087f96ce (patch) | |
tree | d65d10e0d03fee629348b39f15e01600d97f4d12 | |
parent | 4653f8026065ed82cdee35af1fb4b05628db0665 (diff) | |
download | CMake-a8634b878a071815989049ec814e6016087f96ce.zip CMake-a8634b878a071815989049ec814e6016087f96ce.tar.gz CMake-a8634b878a071815989049ec814e6016087f96ce.tar.bz2 |
Help:ENV: note escaping needed for special characters
-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. |