diff options
Diffstat (limited to 'third-party/cmake/CopyFilesGlob.cmake')
-rw-r--r-- | third-party/cmake/CopyFilesGlob.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/third-party/cmake/CopyFilesGlob.cmake b/third-party/cmake/CopyFilesGlob.cmake new file mode 100644 index 0000000000..056da32fd4 --- /dev/null +++ b/third-party/cmake/CopyFilesGlob.cmake @@ -0,0 +1,18 @@ +# Copy multiple files to destination, based on a glob expression +# - FROM_GLOB +# - TO + +if(NOT FROM_GLOB) + message(FATAL_ERROR "FROM_GLOB must be set") +endif() +if(NOT TO) + message(FATAL_ERROR "TO must be set") +endif() + +file(GLOB files ${FROM_GLOB}) +foreach(file ${files}) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${file} ${TO} RESULT_VARIABLE rv) + if(NOT rv EQUAL 0) + message(FATAL_ERROR "Error copying ${file}") + endif() +endforeach() |