summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake
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 /Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake
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 'Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake')
-rw-r--r--Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake5
1 files changed, 5 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake
new file mode 100644
index 0000000..c05dd63
--- /dev/null
+++ b/Tests/RunCMake/file/RENAME-file-NO_REPLACE-fail.cmake
@@ -0,0 +1,5 @@
+set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input")
+set(newname "${CMAKE_CURRENT_BINARY_DIR}/output")
+file(WRITE "${oldname}" "a")
+file(WRITE "${newname}" "b")
+file(RENAME "${oldname}" "${newname}" NO_REPLACE)