diff options
author | Aki <please@ignore.pl> | 2022-09-17 11:36:24 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-09-17 11:36:24 +0200 |
commit | 3a35b7cfb4127593127a86b302e668e0e007e58c (patch) | |
tree | 988d09543c9a074715b8d934897350c5c7e2b530 | |
parent | c8ae289dd963e154f317a8e7df7ee547871833ea (diff) | |
download | starshatter-3a35b7cfb4127593127a86b302e668e0e007e58c.zip starshatter-3a35b7cfb4127593127a86b302e668e0e007e58c.tar.gz starshatter-3a35b7cfb4127593127a86b302e668e0e007e58c.tar.bz2 |
Added cmake function to install resources directly
-rw-r--r-- | cmake/modules/InstallResource.cmake | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/cmake/modules/InstallResource.cmake b/cmake/modules/InstallResource.cmake new file mode 100644 index 0000000..2b3176e --- /dev/null +++ b/cmake/modules/InstallResource.cmake @@ -0,0 +1,29 @@ +# Installs content of a downloadable resource target from AddDownloadableResource as-is. For example: +# +# install_resource( +# resource_music +# DESTINATION ${CMAKE_INSTALL_PREFIX}/ +# ) +# +# Will copy the content of the music resource directly into the CMAKE_INSTALL_PREFIX effectively rooting the archive +# content at the prefix itself. + +function(install_resource) + cmake_parse_arguments( + PARSE_ARGV 0 + INSTALL_RESOURCE + "" + "DESTINATION" + "" + ) + if(NOT DEFINED INSTALL_RESOURCE_DESTINATION) + set(INSTALL_RESOURCE_DESTINATION ${CMAKE_INSTALL_DATADIR}/) + endif() + foreach(RESOURCE_TARGET IN ITEMS ${INSTALL_RESOURCE_UNPARSED_ARGUMENTS}) + get_property(RESOURCE_DIRECTORY TARGET ${RESOURCE_TARGET} PROPERTY RESOURCE_DIRECTORY) + install( + DIRECTORY ${RESOURCE_DIRECTORY}/ + DESTINATION ${INSTALL_RESOURCE_DESTINATION} + ) + endforeach() +endfunction() |