blob: 2c443cd4e30929c9a968b642259a19202748e354 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# 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;COMPONENT"
""
)
if(NOT DEFINED INSTALL_RESOURCE_DESTINATION)
set(INSTALL_RESOURCE_DESTINATION ${CMAKE_INSTALL_DATADIR}/)
endif()
if(NOT DEFINED INSTALL_RESOURCE_COMPONENT)
set(INSTALL_RESOURCE_COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME})
endif()
foreach(RESOURCE_TARGET IN ITEMS ${INSTALL_RESOURCE_UNPARSED_ARGUMENTS})
get_property(RESOURCE_DIRECTORY TARGET ${RESOURCE_TARGET} PROPERTY RESOURCE_DIRECTORY)
install(
DIRECTORY ${RESOURCE_DIRECTORY}/
COMPONENT ${INSTALL_RESOURCE_COMPONENT}
DESTINATION ${INSTALL_RESOURCE_DESTINATION}
)
endforeach()
endfunction()
|