1 #! \ingroup MicroServicesCMake
2 #! \brief Get a source file name for handling resource dependencies
4 #! This CMake function retrieves the name of a generated file which has to be added
5 #! to a modules source file list to set-up resource file dependencies. This ensures
6 #! that changed resource files will automatically be re-added to the module.
10 #! set(module_srcs mylib.cpp)
11 #! usFunctionGetResourceSource(TARGET mylib
14 #! add_library(mylib ${module_srcs})
17 #! \param TARGET (required) The name of the target to which the resource files are added.
18 #! \param OUT (required) A list variable to which the file name will be appended.
19 #! \param LINK (optional) Generate a suitable source file for LINK mode.
20 #! \param APPEND (optional) Generate a suitable source file for APPEND mode.
22 #! \sa usFunctionAddResources
23 #! \sa usFunctionEmbedResources
26 cmake_parse_arguments(_res
"LINK;APPEND" "TARGET;OUT" "" "" ${ARGN})
28 message(SEND_ERROR
"TARGET must not be empty")
31 message(SEND_ERROR "OUT argument must not be empty")
33 if(_res_LINK AND _res_APPEND)
34 message(SEND_ERROR "Both
LINK and APPEND options given.")
37 set(_out "${CMAKE_CURRENT_BINARY_DIR}/us_${_res_TARGET}/us_resources
")
39 set(_out "${_out}${US_RESOURCE_SOURCE_SUFFIX_LINK}
")
41 set(_out "${_out}${US_RESOURCE_SOURCE_SUFFIX_APPEND}
")
43 set(_out "${_out}${US_RESOURCE_SOURCE_SUFFIX}
")
46 set(${_res_OUT} ${${_res_OUT}} ${_out} PARENT_SCOPE)
usFunctionGetResourceSource()
Get a source file name for handling resource dependencies.