2015-12-19 21:50:20 -07:00
|
|
|
# In Windows we need to find dependency DLLs and install them along with our
|
|
|
|
# binaries. This script uses the following variables:
|
|
|
|
#
|
|
|
|
# - BINARY: The binary file whose dependencies need to be installed
|
|
|
|
# - DST: The destination path
|
|
|
|
# - CMAKE_PREFIX_PATH: A list of directories to search for dependencies
|
|
|
|
|
|
|
|
if(NOT DEFINED BINARY)
|
2023-02-08 03:00:16 -07:00
|
|
|
message(FATAL_ERROR "Missing required argument -D BINARY=")
|
2015-12-19 21:50:20 -07:00
|
|
|
endif()
|
|
|
|
if(NOT DEFINED DST)
|
2023-02-08 03:00:16 -07:00
|
|
|
message(FATAL_ERROR "Missing required arguments -D DST=")
|
2015-12-19 21:50:20 -07:00
|
|
|
endif()
|
|
|
|
if(NOT DEFINED CMAKE_PREFIX_PATH)
|
2023-02-08 03:00:16 -07:00
|
|
|
message(FATAL_ERROR "Missing required arguments -D CMAKE_PREFIX_PATH=")
|
2015-12-19 21:50:20 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include(GetPrerequisites)
|
|
|
|
get_prerequisites(${BINARY} DLLS 1 1 "" "${CMAKE_PREFIX_PATH}")
|
|
|
|
foreach(DLL_NAME ${DLLS})
|
|
|
|
find_program(DLL_PATH ${DLL_NAME})
|
|
|
|
if(NOT DLL_PATH)
|
|
|
|
message(FATAL_ERROR "Unable to find dependency ${DLL_NAME}")
|
|
|
|
endif()
|
|
|
|
|
2023-02-14 10:58:38 -07:00
|
|
|
if($ENV{CI} MATCHES "true")
|
|
|
|
message("Copying ${DLL_NAME} to ${DST}")
|
|
|
|
endif()
|
2015-12-19 21:50:20 -07:00
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DLL_PATH} ${DST})
|
|
|
|
unset(DLL_PATH CACHE)
|
|
|
|
endforeach()
|