+ add_custom_command(VERBATIM
+ COMMENT "Generating ${qrc_src}"
+ COMMAND ${cat_cmd} "$<SHELL_PATH:${qrc_filepath}>"
+ | "$<SHELL_PATH:$<TARGET_FILE:Qt5::rcc>>" --name "${lower_name}" --output "$<SHELL_PATH:${qrc_srcpath}>" -
+ DEPENDS ${qrc_target}
+ MAIN_DEPENDENCY ${qrc_filepath}
+ OUTPUT ${qrc_srcpath}
+ WORKING_DIRECTORY ${basedir}
+ )
+
+ # Generate library target that can be referenced elsewhere
+ quassel_add_module(Resource::${_name})
+ target_sources(${TARGET} PRIVATE ${qrc_srcpath})
+ set_target_properties(${TARGET} PROPERTIES AUTOMOC OFF AUTOUIC OFF AUTORCC OFF)
+
+ # Set variable for referencing the target from outside
+ set(RESOURCE_TARGET ${TARGET} PARENT_SCOPE)
+endfunction()
+
+###################################################################################################
+# target_link_if_exists(Target
+# [PUBLIC dep1 dep2...]
+# [PRIVATE dep3 dep4...]
+# )
+#
+# Convenience function to add dependencies to a target only if they exist. This is useful when
+# handling targets that are conditionally created, e.g. resource libraries depending on -DEMBED_DATA.
+#
+# NOTE: In order to link a given target, it must already have been created, i.e its subdirectory
+# must already have been added. This is also true for globally visible ALIAS targets that
+# can otherwise be linked to regardless of creation order; "if (TARGET...)" does not
+# support handling this case correctly.
+#
+function(target_link_if_exists _target)
+ set(options )
+ set(oneValueArgs )
+ set(multiValueArgs PUBLIC PRIVATE)
+ cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})