aboutsummaryrefslogtreecommitdiff
path: root/cmake/GdbusCodegen.cmake
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-03-23 10:04:13 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-03-23 10:04:13 -0500
commitca4b40ade7f432d98c21ac499a0de63244b1c3cc (patch)
tree8d76a7642ab1158f5a35230a1b1f7e3a08e59e8e /cmake/GdbusCodegen.cmake
parentd782f784d486fd726a870fb9c03e49bd6ef6877c (diff)
downloadayatana-indicator-session-ca4b40ade7f432d98c21ac499a0de63244b1c3cc.tar.gz
ayatana-indicator-session-ca4b40ade7f432d98c21ac499a0de63244b1c3cc.tar.bz2
ayatana-indicator-session-ca4b40ade7f432d98c21ac499a0de63244b1c3cc.zip
use pete woods' hud cmake code for the build.sh script to check for Ninja and to move the gdbus-codegen macros into a resuable file in the cmake/ directory.
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)