summaryrefslogtreecommitdiffstats
path: root/Help/command/file.rst
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-03-04 13:13:16 (GMT)
committerBrad King <brad.king@kitware.com>2021-03-04 13:49:48 (GMT)
commit9bf40d8027ec9fb91ad995919f6db673c15558dc (patch)
tree2bac35f6c7d1be1e0788724ca86d1a3d9e5c43e2 /Help/command/file.rst
parent3600c6cd8c09e501faa06be5f98465e994d51569 (diff)
downloadCMake-9bf40d8027ec9fb91ad995919f6db673c15558dc.zip
CMake-9bf40d8027ec9fb91ad995919f6db673c15558dc.tar.gz
CMake-9bf40d8027ec9fb91ad995919f6db673c15558dc.tar.bz2
file(RENAME): Add option to not replace existing path
Add a `NO_REPLACE` option that prevents overwriting `<newname>` if it exists.
Diffstat (limited to 'Help/command/file.rst')
-rw-r--r--Help/command/file.rst8
1 files changed, 7 insertions, 1 deletions
diff --git a/Help/command/file.rst b/Help/command/file.rst
index b28e206..9cde90c 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -666,7 +666,8 @@ Examples of recursive globbing include::
.. code-block:: cmake
file(RENAME <oldname> <newname>
- [RESULT <result>])
+ [RESULT <result>]
+ [NO_REPLACE])
Move a file or directory within a filesystem from ``<oldname>`` to
``<newname>``, replacing the destination atomically.
@@ -677,6 +678,11 @@ The options are:
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.
+``NO_REPLACE``
+ If the ``<newname>`` path already exists, do not replace it.
+ If ``RESULT <result>`` is used, the result variable will be
+ set to ``NO_REPLACE``. Otherwise, an error is emitted.
+
.. _REMOVE:
.. _REMOVE_RECURSE: