file(): Add REAL_PATH sub-command

This commit is contained in:
Marc Chevrier
2020-08-26 14:33:18 +02:00
parent 503d0f80e1
commit be36266dab
12 changed files with 95 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ Synopsis
file(`CHMOD_RECURSE`_ <files>... <directories>... PERMISSIONS <permissions>... [...])
`Path Conversion`_
file(`REAL_PATH`_ <path> <out-var> [BASE_DIRECTORY <dir>])
file(`RELATIVE_PATH`_ <out-var> <directory> <file>)
file({`TO_CMAKE_PATH`_ | `TO_NATIVE_PATH`_} <path> <out-var>)
@@ -806,6 +807,19 @@ the ``<directories>..`` recursively.
Path Conversion
^^^^^^^^^^^^^^^
.. _REAL_PATH:
.. code-block:: cmake
file(REAL_PATH <path> <out-var> [BASE_DIRECTORY <dir>])
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`.
.. _RELATIVE_PATH:
.. code-block:: cmake

View File

@@ -46,8 +46,9 @@ cache.
.. note::
All previous sub-commands, except ``REALPATH``, has been superseded by
:command:`cmake_path` command.
All previous sub-commands has been superseded by
:command:`cmake_path` command, except ``REALPATH`` now offered by
:ref:`file(REAL_PATH) <REAL_PATH>` command.
.. code-block:: cmake