robin/laufey

git clone https://git.robinwobin.dev/robin/laufey

dundargocbuild: various fixesc50951a4d0

master
1.0 KiB31 linesraw
1# In Windows we need to find dependency DLLs and install them along with our
2# binaries. This script uses the following variables:
3#
4# - BINARY: The binary file whose dependencies need to be installed
5# - DST: The destination path
6# - CMAKE_PREFIX_PATH: A list of directories to search for dependencies
7
8if(NOT DEFINED BINARY)
9  message(FATAL_ERROR "Missing required argument -D BINARY=")
10endif()
11if(NOT DEFINED DST)
12  message(FATAL_ERROR "Missing required arguments -D DST=")
13endif()
14if(NOT DEFINED CMAKE_PREFIX_PATH)
15  message(FATAL_ERROR "Missing required arguments -D CMAKE_PREFIX_PATH=")
16endif()
17
18include(GetPrerequisites)
19get_prerequisites(${BINARY} DLLS 1 1 "" "${CMAKE_PREFIX_PATH}")
20foreach(DLL_NAME ${DLLS})
21  find_program(DLL_PATH ${DLL_NAME})
22  if(NOT DLL_PATH)
23    message(FATAL_ERROR "Unable to find dependency ${DLL_NAME}")
24  endif()
25
26  if(CI_BUILD)
27    message("Copying ${DLL_NAME} to ${DST}")
28  endif()
29  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${DLL_PATH} ${DST})
30  unset(DLL_PATH CACHE)
31endforeach()