file(RENAME): Add option to capture error message on failure

This commit is contained in:
Brad King
2021-03-03 15:54:14 -05:00
parent 0c2dc34504
commit c61292726c
16 changed files with 105 additions and 9 deletions
+9 -2
View File
@@ -38,7 +38,7 @@ Synopsis
`Filesystem`_
file({`GLOB`_ | `GLOB_RECURSE`_} <out-var> [...] [<globbing-expr>...])
file(`RENAME`_ <oldname> <newname>)
file(`RENAME`_ <oldname> <newname> [...])
file({`REMOVE`_ | `REMOVE_RECURSE`_ } [<files>...])
file(`MAKE_DIRECTORY`_ [<dir>...])
file({`COPY`_ | `INSTALL`_} <file>... DESTINATION <dir> [...])
@@ -665,11 +665,18 @@ Examples of recursive globbing include::
.. code-block:: cmake
file(RENAME <oldname> <newname>)
file(RENAME <oldname> <newname>
[RESULT <result>])
Move a file or directory within a filesystem from ``<oldname>`` to
``<newname>``, replacing the destination atomically.
The options are:
``RESULT <result>``
Set ``<result>`` variable to ``0`` on success or an error message otherwise.
If ``RESULT`` is not specified and the operation fails, an error is emitted.
.. _REMOVE:
.. _REMOVE_RECURSE: