CopyFilesGlob.cmake (506B)
1 # Copy multiple files to destination, based on a glob expression 2 # - FROM_GLOB 3 # - TO 4 5 if(NOT FROM_GLOB) 6 message(FATAL_ERROR "FROM_GLOB must be set") 7 endif() 8 if(NOT TO) 9 message(FATAL_ERROR "TO must be set") 10 endif() 11 12 execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TO}) 13 14 file(GLOB files ${FROM_GLOB}) 15 foreach(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() 20 endforeach()