diff options
author | Ted Gould <ted@gould.cx> | 2013-10-31 11:40:41 -0700 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2013-10-31 11:40:41 -0700 |
commit | eb47d698341bc8f1b46433c48fc280d5a4906ad3 (patch) | |
tree | 04e18a96bcad6c22f5079a517c5c8927d1ac49cd /cmake/GdbusCodegen.cmake | |
parent | a4a5562fd93fdd6d9cb4b9cde98126fdca3ea21d (diff) | |
parent | 0439dc69bfd71c42d01b7d11cb586ef056503b28 (diff) | |
download | ayatana-indicator-datetime-eb47d698341bc8f1b46433c48fc280d5a4906ad3.tar.gz ayatana-indicator-datetime-eb47d698341bc8f1b46433c48fc280d5a4906ad3.tar.bz2 ayatana-indicator-datetime-eb47d698341bc8f1b46433c48fc280d5a4906ad3.zip |
Merge trunk
Diffstat (limited to 'cmake/GdbusCodegen.cmake')
-rw-r--r-- | cmake/GdbusCodegen.cmake | 36 |
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) |