summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-01-07 01:54:40 +0100
committerAki <please@ignore.pl>2023-01-07 01:54:40 +0100
commit56f70b43fd5d47f1fbd64ba0eec1490f12dfd339 (patch)
treea5c14033ea1d14514e3c627d5c60862840d7cb2e /cmake
parent99cfb30eeaafac7b11ea8562202e1fece5d3c363 (diff)
downloadkurator-56f70b43fd5d47f1fbd64ba0eec1490f12dfd339.zip
kurator-56f70b43fd5d47f1fbd64ba0eec1490f12dfd339.tar.gz
kurator-56f70b43fd5d47f1fbd64ba0eec1490f12dfd339.tar.bz2
Implemented a CMake function to manage resources
Diffstat (limited to 'cmake')
-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()