~khurshid-alam/hud/upload-to-focal

« back to all changes in this revision

Viewing changes to cmake/GdbusCodegen.cmake

  • Committer: Pete Woods
  • Date: 2013-03-18 17:48:40 UTC
  • mto: (227.119.7 libhud-tests)
  • mto: This revision was merged to the branch mainline in revision 245.
  • Revision ID: pete.woods@canonical.com-20130318174840-u99j3v2hq37d8glt
Enough is working to compile hud-service

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 namespace 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
        --generate-c-code "${name}"
 
16
        --interface-prefix "${prefix}"
 
17
        --c-namespace "${namespace}"
 
18
        "${service_xml}"
 
19
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
20
    DEPENDS ${ARGN} "${service_xml}"
 
21
  )
 
22
  list(APPEND ${outfiles} "${CMAKE_CURRENT_BINARY_DIR}/${name}.c")
 
23
endmacro(add_gdbus_codegen)