summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/file/COPY_FILE-file-replace.cmake
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2021-03-04 16:50:10 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2021-03-10 15:43:18 (GMT)
commit088444211e942a3587f4af5ef76c3654f2562364 (patch)
treefa5bd94beead2050d900e7c2341dc27899b2733e /Tests/RunCMake/file/COPY_FILE-file-replace.cmake
parent100016e9cb31aad7b642a9733409c7294cd6652f (diff)
downloadCMake-088444211e942a3587f4af5ef76c3654f2562364.zip
CMake-088444211e942a3587f4af5ef76c3654f2562364.tar.gz
CMake-088444211e942a3587f4af5ef76c3654f2562364.tar.bz2
file: add `COPY_FILE` subcommand
The `file(COPY)` subcommand is overloaded and busy for such a simple operation. Instead, make a simpler subcommand with error handling support.
Diffstat (limited to 'Tests/RunCMake/file/COPY_FILE-file-replace.cmake')
-rw-r--r--Tests/RunCMake/file/COPY_FILE-file-replace.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Tests/RunCMake/file/COPY_FILE-file-replace.cmake b/Tests/RunCMake/file/COPY_FILE-file-replace.cmake
new file mode 100644
index 0000000..40e4290
--- /dev/null
+++ b/Tests/RunCMake/file/COPY_FILE-file-replace.cmake
@@ -0,0 +1,9 @@
+set(oldname "${CMAKE_CURRENT_BINARY_DIR}/input")
+set(newname "${CMAKE_CURRENT_BINARY_DIR}/output")
+file(WRITE "${oldname}" "a")
+file(WRITE "${newname}" "b")
+file(COPY_FILE "${oldname}" "${newname}")
+file(READ "${newname}" new)
+if(NOT "${new}" STREQUAL "a")
+ message(FATAL_ERROR "New name:\n ${newname}\ndoes not contain expected content 'a'.")
+endif()