neovim/cmake.deps/cmake/CopyFilesGlob.cmake
dundargoc 1086016477
build: cmake cleanup
- Simplify error checking when using execute_process.
- Set BUILD_SHARED_LIBS to OFF when building dependencies.
  This is normally not needed, but msgpack interprets an unset
  BUILD_SHARED_LIBS to build a shared library, which is the opposite of
  the cmake behavior.
- Move function check_lua_module to Util.cmake.
- Remove unnecessary code.
- Make variable naming more consistent
2023-05-13 12:12:29 +02:00

21 lines
506 B
CMake

# 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()
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${TO})
file(GLOB files ${FROM_GLOB})
foreach(file ${files})
execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${file} ${TO} RESULT_VARIABLE rv)
if(rv)
message(FATAL_ERROR "Error copying ${file}")
endif()
endforeach()