From 97fa1412e27e9417fd546ed88f6730618da166be Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 17 Feb 2015 14:45:26 -0800 Subject: [PATCH] copy dlls beside windows executable for all executables --- cmake/macros/AddPathToLibPaths.cmake | 2 +- .../CopyDllsBesideWindowsExecutable.cmake | 24 +++++++++++++++++++ cmake/macros/SetupHifiProject.cmake | 2 ++ interface/CMakeLists.txt | 12 +--------- 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 cmake/macros/CopyDllsBesideWindowsExecutable.cmake diff --git a/cmake/macros/AddPathToLibPaths.cmake b/cmake/macros/AddPathToLibPaths.cmake index 397680a237..f1f7c46a1c 100644 --- a/cmake/macros/AddPathToLibPaths.cmake +++ b/cmake/macros/AddPathToLibPaths.cmake @@ -3,7 +3,7 @@ # cmake/macros # # Copyright 2015 High Fidelity, Inc. -# Created by Stephen Birarda on February 13, 2014 +# Created by Stephen Birarda on February 17, 2014 # # Distributed under the Apache License, Version 2.0. # See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html diff --git a/cmake/macros/CopyDllsBesideWindowsExecutable.cmake b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake new file mode 100644 index 0000000000..b0379e4764 --- /dev/null +++ b/cmake/macros/CopyDllsBesideWindowsExecutable.cmake @@ -0,0 +1,24 @@ +# +# CopyDllsBesideWindowsExecutable.cmake +# cmake/macros +# +# Copyright 2015 High Fidelity, Inc. +# Created by Stephen Birarda on February 17, 2014 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# + +macro(COPY_DLLS_BESIDE_WINDOWS_EXECUTABLE) + if (WIN32) + # add a post-build command to copy DLLs beside the interface executable + add_custom_command( + TARGET ${TARGET_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + -DBUNDLE_EXECUTABLE=$ + -DLIB_PATHS=${LIB_PATHS} + -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake + ) + endif () +endmacro() \ No newline at end of file diff --git a/cmake/macros/SetupHifiProject.cmake b/cmake/macros/SetupHifiProject.cmake index 3f9787faa1..8b3bc43101 100644 --- a/cmake/macros/SetupHifiProject.cmake +++ b/cmake/macros/SetupHifiProject.cmake @@ -34,4 +34,6 @@ macro(SETUP_HIFI_PROJECT) foreach(QT_MODULE ${${TARGET_NAME}_DEPENDENCY_QT_MODULES}) target_link_libraries(${TARGET_NAME} Qt5::${QT_MODULE}) endforeach() + + copy_dlls_beside_windows_executable() endmacro() \ No newline at end of file diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index fd13aa7092..200d7a72e6 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -239,17 +239,7 @@ else (APPLE) endif() endif (APPLE) -if (WIN32) - # add a post-build command to copy DLLs beside the interface executable - add_custom_command( - TARGET ${TARGET_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} - -DBUNDLE_EXECUTABLE=$ - -DLIB_PATHS=${LIB_PATHS} - -P ${HIFI_CMAKE_DIR}/scripts/FixupBundlePostBuild.cmake - ) -endif () +copy_dlls_beside_windows_executable() # link any dependencies bubbled up from our linked dependencies include_dependency_includes()