2020-11-21 19:03:55 +01:00
|
|
|
# This is a helper script to run BundleUtilities fixup_bundle as postbuild
|
|
|
|
# for a target. The primary use case is to copy .DLLs to the build directory for
|
|
|
|
# the Windows platform. It allows generator expressions to be used to determine
|
|
|
|
# the binary location
|
|
|
|
#
|
|
|
|
# Usage : copy_dlls_for_debug TARGET LIBS DIRS
|
|
|
|
# - TARGET : A cmake target
|
|
|
|
# - See fixup_bundle for LIBS and DIRS arguments
|
|
|
|
|
|
|
|
if(RUN_IT)
|
|
|
|
# Script ran by the add_custom_command
|
|
|
|
include(BundleUtilities)
|
|
|
|
include(InstallRequiredSystemLibraries)
|
|
|
|
fixup_bundle("${TO_FIXUP_FILE}" "${TO_FIXUP_LIBS}" "${TO_FIXUP_DIRS}")
|
|
|
|
# End of script ran by the add_custom_command
|
|
|
|
else()
|
|
|
|
|
|
|
|
set(THIS_FILE ${CMAKE_CURRENT_LIST_FILE})
|
2021-01-27 00:41:54 +01:00
|
|
|
function(copy_dlls_for_debug _targets _libs _dirs)
|
2020-11-21 19:03:55 +01:00
|
|
|
if(WIN32)
|
2021-01-27 00:41:54 +01:00
|
|
|
foreach(_target ${_targets})
|
|
|
|
add_custom_command(
|
|
|
|
TARGET ${_target} POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -DRUN_IT:BOOL=ON -DTO_FIXUP_FILE=$<TARGET_FILE:${_target}> -DTO_FIXUP_LIBS=${_libs} -DTO_FIXUP_DIRS=${_dirs} -P ${THIS_FILE}
|
|
|
|
COMMENT "Fixing up dependencies for ${_target}"
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
endforeach()
|
2020-11-21 19:03:55 +01:00
|
|
|
endif(WIN32)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
endif()
|