summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-26 15:30:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-04-26 15:30:57 (GMT)
commit6aabf2790c4e4f904aeaa166bf6a7abdd2f290e3 (patch)
tree9f50fc14b4aa9f030e7cd8019bd7e6f8c58c0e98 /Help
parent2fcd6a0242cba2d063aef2bc75c4d0f9982ca593 (diff)
parente4b793c614f2a499d4d235ec2267ad6bff56a697 (diff)
downloadCMake-6aabf2790c4e4f904aeaa166bf6a7abdd2f290e3.zip
CMake-6aabf2790c4e4f904aeaa166bf6a7abdd2f290e3.tar.gz
CMake-6aabf2790c4e4f904aeaa166bf6a7abdd2f290e3.tar.bz2
Merge topic 'file-REAL_PATH-EXPAND_TILDE'
e4b793c614 file(REAL_PATH): add option EXPAND_TILDE Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Michael Hirsch <michael@scivision.dev> Merge-request: !6033
Diffstat (limited to 'Help')
-rw-r--r--Help/command/cmake_path.rst3
-rw-r--r--Help/command/file.rst20
-rw-r--r--Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst5
3 files changed, 22 insertions, 6 deletions
diff --git a/Help/command/cmake_path.rst b/Help/command/cmake_path.rst
index a8999f3..193180d 100644
--- a/Help/command/cmake_path.rst
+++ b/Help/command/cmake_path.rst
@@ -687,7 +687,8 @@ When the ``NORMALIZE`` option is specified, the path is :ref:`normalized
<Normalization>` after the path computation.
Because ``cmake_path()`` does not access the filesystem, symbolic links are
-not resolved. To compute a real path with symbolic links resolved, use the
+not resolved and any leading tilde is not expanded. To compute a real path
+with symbolic links resolved and leading tildes expanded, use the
:command:`file(REAL_PATH)` command instead.
Native Conversion
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 62642cf..e170526 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -50,7 +50,7 @@ Synopsis
file(`CHMOD_RECURSE`_ <files>... <directories>... PERMISSIONS <permissions>... [...])
`Path Conversion`_
- file(`REAL_PATH`_ <path> <out-var> [BASE_DIRECTORY <dir>])
+ file(`REAL_PATH`_ <path> <out-var> [BASE_DIRECTORY <dir>] [EXPAND_TILDE])
file(`RELATIVE_PATH`_ <out-var> <directory> <file>)
file({`TO_CMAKE_PATH`_ | `TO_NATIVE_PATH`_} <path> <out-var>)
@@ -924,16 +924,26 @@ Path Conversion
.. code-block:: cmake
- file(REAL_PATH <path> <out-var> [BASE_DIRECTORY <dir>])
+ file(REAL_PATH <path> <out-var> [BASE_DIRECTORY <dir>] [EXPAND_TILDE])
.. versionadded:: 3.19
Compute the absolute path to an existing file or directory with symlinks
resolved.
-If the provided ``<path>`` is a relative path, it is evaluated relative to the
-given base directory ``<dir>``. If no base directory is provided, the default
-base directory will be :variable:`CMAKE_CURRENT_SOURCE_DIR`.
+``BASE_DIRECTORY <dir>``
+ If the provided ``<path>`` is a relative path, it is evaluated relative to the
+ given base directory ``<dir>``. If no base directory is provided, the default
+ base directory will be :variable:`CMAKE_CURRENT_SOURCE_DIR`.
+
+``EXPAND_TILDE``
+ .. versionadded:: 3.21
+
+ If the ``<path>`` is ``~`` or starts with ``~/``, the ``~`` is replaced by
+ the user's home directory. The path to the home directory is obtained from
+ environment variables. On Windows, the ``USERPROFILE`` environment variable
+ is used, falling back to the ``HOME`` environment variable if ``USERPROFILE``
+ is not defined. On all other platforms, only ``HOME`` is used.
.. _RELATIVE_PATH:
diff --git a/Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst b/Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst
new file mode 100644
index 0000000..cdf1efa
--- /dev/null
+++ b/Help/release/dev/file-REAL_PATH-EXPAND_TILDE.rst
@@ -0,0 +1,5 @@
+file-REAL_PATH-EXPAND_TILDE
+---------------------------
+
+* The :command:`file(REAL_PATH)` command gained the option ``EXPAND_TILDE`` to
+ replace any leading tilde with the path to the user's home directory.