robin/laufey

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

dundargocbuild: cmake cleanup1086016477

master
506 B20 linesraw
1# Copy multiple files to destination, based on a glob expression
2# - FROM_GLOB
3# - TO
4
5if(NOT FROM_GLOB)
6  message(FATAL_ERROR "FROM_GLOB must be set")
7endif()
8if(NOT TO)
9  message(FATAL_ERROR "TO must be set")
10endif()
11
12execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TO})
13
14file(GLOB files ${FROM_GLOB})
15foreach(file ${files})
16  execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${file} ${TO} RESULT_VARIABLE rv)
17  if(rv)
18    message(FATAL_ERROR "Error copying ${file}")
19  endif()
20endforeach()