summaryrefslogtreecommitdiffstats
path: root/externals/cmake-modules/WindowsCopyFiles.cmake
diff options
context:
space:
mode:
authorMerryMage <MerryMage@users.noreply.github.com>2016-03-01 18:24:18 +0100
committerMerryMage <MerryMage@users.noreply.github.com>2016-03-02 15:09:02 +0100
commitba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab (patch)
tree182d660b2f2c8572266144f46817e5a221aa4caf /externals/cmake-modules/WindowsCopyFiles.cmake
parentMerge pull request #1424 from MerryMage/lut_init (diff)
downloadyuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.tar
yuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.tar.gz
yuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.tar.bz2
yuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.tar.lz
yuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.tar.xz
yuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.tar.zst
yuzu-ba2a54a9dd6e5a263c5e6886e55b3bc55b95b4ab.zip
Diffstat (limited to '')
-rw-r--r--externals/cmake-modules/WindowsCopyFiles.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/externals/cmake-modules/WindowsCopyFiles.cmake b/externals/cmake-modules/WindowsCopyFiles.cmake
new file mode 100644
index 000000000..cd0c2ce47
--- /dev/null
+++ b/externals/cmake-modules/WindowsCopyFiles.cmake
@@ -0,0 +1,28 @@
+# Copyright 2016 Citra Emulator Project
+# Licensed under GPLv2 or any later version
+# Refer to the license.txt file included.
+
+# This file provides the function windows_copy_files.
+# This is only valid on Windows.
+
+# Include guard
+if(__windows_copy_files)
+ return()
+endif()
+set(__windows_copy_files YES)
+
+# Any number of files to copy from SOURCE_DIR to DEST_DIR can be specified after DEST_DIR.
+# This copying happens post-build.
+function(windows_copy_files TARGET SOURCE_DIR DEST_DIR)
+ # windows commandline expects the / to be \ so switch them
+ string(REPLACE "/" "\\\\" SOURCE_DIR ${SOURCE_DIR})
+ string(REPLACE "/" "\\\\" DEST_DIR ${DEST_DIR})
+
+ # /NJH /NJS /NDL /NFL /NC /NS /NP - Silence any output
+ # cmake adds an extra check for command success which doesn't work too well with robocopy
+ # so trick it into thinking the command was successful with the || cmd /c "exit /b 0"
+ add_custom_command(TARGET ${TARGET} POST_BUILD
+ COMMAND if not exist ${DEST_DIR} mkdir ${DEST_DIR} 2> nul
+ COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0"
+ )
+endfunction() \ No newline at end of file