aboutsummaryrefslogtreecommitdiff
path: root/cmake/GdbusCodegen.cmake
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-11-11 23:20:01 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2020-11-11 23:20:01 +0100
commitf34109bd521020e8a1fb900177c43796b5f6f3ca (patch)
tree558d0879ddc9318f7e9c0bb7362fd7f086fa29f0 /cmake/GdbusCodegen.cmake
parentf872e9097ff373a172119bd3f7e9d0ef84b31ce1 (diff)
parentf9a39b44803e6347c72c1edd8ba46f633e99dd57 (diff)
downloadayatana-indicator-notifications-f34109bd521020e8a1fb900177c43796b5f6f3ca.tar.gz
ayatana-indicator-notifications-f34109bd521020e8a1fb900177c43796b5f6f3ca.tar.bz2
ayatana-indicator-notifications-f34109bd521020e8a1fb900177c43796b5f6f3ca.zip
Merge branch 'tari01-pr/system-indicator-rewrite'
Attributes GH PR #13: https://github.com/AyatanaIndicators/ayatana-indicator-notifications/pull/13
Diffstat (limited to 'cmake/GdbusCodegen.cmake')
-rw-r--r--cmake/GdbusCodegen.cmake36
1 files changed, 36 insertions, 0 deletions
diff --git a/cmake/GdbusCodegen.cmake b/cmake/GdbusCodegen.cmake
new file mode 100644
index 0000000..ddb2995
--- /dev/null
+++ b/cmake/GdbusCodegen.cmake
@@ -0,0 +1,36 @@
+cmake_minimum_required(VERSION 2.6)
+if(POLICY CMP0011)
+ cmake_policy(SET CMP0011 NEW)
+endif(POLICY CMP0011)
+
+find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable")
+if(NOT GDBUS_CODEGEN)
+ message(FATAL_ERROR "Excutable gdbus-codegen not found")
+endif()
+
+macro(add_gdbus_codegen outfiles name prefix service_xml)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
+ COMMAND "${GDBUS_CODEGEN}"
+ --interface-prefix "${prefix}"
+ --generate-c-code "${name}"
+ "${service_xml}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${ARGN} "${service_xml}"
+ )
+ list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
+endmacro(add_gdbus_codegen)
+
+macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml)
+ add_custom_command(
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
+ COMMAND "${GDBUS_CODEGEN}"
+ --interface-prefix "${prefix}"
+ --generate-c-code "${name}"
+ --c-namespace "${namespace}"
+ "${service_xml}"
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS ${ARGN} "${service_xml}"
+ )
+ list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
+endmacro(add_gdbus_codegen_with_namespace)