summaryrefslogtreecommitdiffstats
path: root/cmake/QtAppManHelpers.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/QtAppManHelpers.cmake')
-rw-r--r--cmake/QtAppManHelpers.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/cmake/QtAppManHelpers.cmake b/cmake/QtAppManHelpers.cmake
new file mode 100644
index 00000000..d19120a8
--- /dev/null
+++ b/cmake/QtAppManHelpers.cmake
@@ -0,0 +1,21 @@
+# This function is a hack to make generating DBus adaptors without custom cpp files possible
+function(qtam_internal_add_dbus_adaptor target)
+ if (NOT TARGET "${target}")
+ message(FATAL_ERROR "Trying to extend non-existing target \"${target}\".")
+ endif()
+
+ cmake_parse_arguments(arg "" "" "DBUS_ADAPTOR_SOURCES;DBUS_ADAPTOR_FLAGS" ${ARGN})
+
+ foreach(adaptor ${arg_DBUS_ADAPTOR_SOURCES})
+ qt_internal_extend_target(${target}
+ DBUS_ADAPTOR_SOURCES ${adaptor}
+ DBUS_ADAPTOR_FLAGS ${arg_DBUS_ADAPTOR_FLAGS}
+ )
+
+ # hack to remove the .cpp file, which we implement ourselves
+ get_target_property(srcs ${target} SOURCES)
+ list(REMOVE_AT srcs -1)
+ set_target_properties(${target} PROPERTIES SOURCES "${srcs}")
+
+ endforeach()
+endfunction()