~codygarver/+junk/ind-sess

« back to all changes in this revision

Viewing changes to cmake/GdbusCodegen.cmake

  • Committer: Cody Garver
  • Date: 2014-04-03 17:08:08 UTC
  • Revision ID: cody@elementaryos.org-20140403170808-z56s93rorb1dzvmk
Initial import, version 12.10.5+14.04.20140324-0ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
cmake_minimum_required(VERSION 2.6)
 
2
if(POLICY CMP0011)
 
3
  cmake_policy(SET CMP0011 NEW)
 
4
endif(POLICY CMP0011)
 
5
 
 
6
find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable")
 
7
if(NOT GDBUS_CODEGEN)
 
8
  message(FATAL_ERROR "Excutable gdbus-codegen not found")
 
9
endif()
 
10
 
 
11
macro(add_gdbus_codegen outfiles name prefix service_xml)
 
12
  add_custom_command(
 
13
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
 
14
    COMMAND "${GDBUS_CODEGEN}"
 
15
        --interface-prefix "${prefix}"
 
16
        --generate-c-code "${name}"
 
17
        "${service_xml}"
 
18
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
19
    DEPENDS ${ARGN} "${service_xml}"
 
20
  )
 
21
  list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
 
22
endmacro(add_gdbus_codegen)
 
23
 
 
24
macro(add_gdbus_codegen_with_namespace outfiles name prefix namespace service_xml)
 
25
  add_custom_command(
 
26
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${name}.h" "${CMAKE_CURRENT_BINARY_DIR}/${name}.c"
 
27
    COMMAND "${GDBUS_CODEGEN}"
 
28
        --interface-prefix "${prefix}"
 
29
        --generate-c-code "${name}"
 
30
        --c-namespace "${namespace}"
 
31
        "${service_xml}"
 
32
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
33
    DEPENDS ${ARGN} "${service_xml}"
 
34
  )
 
35
  list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
 
36
endmacro(add_gdbus_codegen_with_namespace)