robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
c50951a4d0
master
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) 9message ( FATAL_ERROR "Missing required argument -D BINARY=" ) 10endif () 11if ( NOT DEFINED DST) 12message ( FATAL_ERROR "Missing required arguments -D DST=" ) 13endif () 14if ( NOT DEFINED CMAKE_PREFIX_PATH) 15message ( 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 }) 21find_program ( DLL_PATH ${ DLL_NAME }) 22if ( NOT DLL_PATH) 23message ( FATAL_ERROR "Unable to find dependency ${ DLL_NAME } " ) 24endif () 25 26if ( CI_BUILD) 27message ( "Copying ${ DLL_NAME } to ${ DST } " ) 28endif () 29execute_process ( COMMAND ${ CMAKE_COMMAND } -E copy ${ DLL_PATH } ${ DST }) 30unset ( DLL_PATH CACHE ) 31endforeach ()