diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-01-02 19:45:36 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-02 19:45:36 +0100 |
commit | a7e610403df97203a2ab5c7eb53c7d11960b3d79 (patch) | |
tree | c17a3f5362f35d7ffbcc46c881f1b656e71db81b /CMakeModules/WindowsCopyFiles.cmake | |
parent | Merge pull request #9541 from abouvier/cmake-option (diff) | |
parent | cmake: move find-modules to root cmake dir (diff) | |
download | yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.tar yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.tar.gz yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.tar.bz2 yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.tar.lz yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.tar.xz yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.tar.zst yuzu-a7e610403df97203a2ab5c7eb53c7d11960b3d79.zip |
Diffstat (limited to 'CMakeModules/WindowsCopyFiles.cmake')
-rw-r--r-- | CMakeModules/WindowsCopyFiles.cmake | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/CMakeModules/WindowsCopyFiles.cmake b/CMakeModules/WindowsCopyFiles.cmake new file mode 100644 index 000000000..08b598365 --- /dev/null +++ b/CMakeModules/WindowsCopyFiles.cmake @@ -0,0 +1,27 @@ +# SPDX-FileCopyrightText: 2018 yuzu Emulator Project +# SPDX-License-Identifier: GPL-2.0-or-later + +# 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 ${CMAKE_COMMAND} -E make_directory ${DEST_DIR} + COMMAND robocopy ${SOURCE_DIR} ${DEST_DIR} ${ARGN} /NJH /NJS /NDL /NFL /NC /NS /NP || cmd /c "exit /b 0" + ) +endfunction() |