summaryrefslogtreecommitdiff
path: root/cmake/modules
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules')
-rw-r--r--cmake/modules/AddResources.cmake27
1 files changed, 27 insertions, 0 deletions
diff --git a/cmake/modules/AddResources.cmake b/cmake/modules/AddResources.cmake
new file mode 100644
index 0000000..4f4f800
--- /dev/null
+++ b/cmake/modules/AddResources.cmake
@@ -0,0 +1,27 @@
+function(add_resources RESOURCES_TARGET)
+ cmake_parse_arguments(
+ PARSE_ARGV 1
+ RESOURCES
+ ""
+ "PREFIX"
+ "FILES"
+ )
+ if(NOT DEFINED RESOURCES_PREFIX)
+ set(RESOURCES_PREFIX ${CMAKE_BINARY_DIR})
+ endif()
+ foreach(RESOURCES_SOURCE IN ITEMS ${RESOURCES_FILES})
+ add_custom_command(
+ OUTPUT "${RESOURCES_PREFIX}/${RESOURCES_SOURCE}"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCES_SOURCE}"
+ COMMAND
+ ${CMAKE_COMMAND} -E copy
+ "${CMAKE_CURRENT_SOURCE_DIR}/${RESOURCES_SOURCE}"
+ "${RESOURCES_PREFIX}/${RESOURCES_SOURCE}"
+ )
+ endforeach()
+ list(TRANSFORM RESOURCES_FILES PREPEND "${RESOURCES_PREFIX}/")
+ add_custom_target(
+ ${RESOURCES_TARGET} ALL
+ DEPENDS ${RESOURCES_FILES}
+ )
+endfunction()