~ubuntu-branches/ubuntu/saucy/hud/saucy-proposed

« back to all changes in this revision

Viewing changes to cmake/UseGdbusCodegen.cmake

  • Committer: Package Import Robot
  • Author(s): Ubuntu daily release
  • Date: 2013-06-05 12:33:44 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: package-import@ubuntu.com-20130605123344-cpp4to647tyfv7kr
Tags: upstream-13.10.1daily13.06.05.1
ImportĀ upstreamĀ versionĀ 13.10.1daily13.06.05.1

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
function(add_gdbus_codegen)
 
12
  set(_one_value OUTFILES NAME PREFIX NAMESPACE SERVICE_XML)
 
13
  set(_multi_value DEPENDS)
 
14
  cmake_parse_arguments (arg "" "${_one_value}" "${_multi_value}" ${ARGN})
 
15
 
 
16
  if(arg_PREFIX)
 
17
    set(PREFIX --interface-prefix ${arg_PREFIX})
 
18
  endif()
 
19
  
 
20
  if(arg_NAMESPACE)
 
21
    set(NAMESPACE --c-namespace ${arg_NAMESPACE})
 
22
  endif()
 
23
  
 
24
  add_custom_command(
 
25
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${arg_NAME}.h" "${CMAKE_CURRENT_BINARY_DIR}/${arg_NAME}.c"
 
26
    COMMAND "${GDBUS_CODEGEN}"
 
27
        --generate-c-code "${arg_NAME}"
 
28
        ${PREFIX}
 
29
        ${NAMESPACE}
 
30
        "${arg_SERVICE_XML}"
 
31
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 
32
    DEPENDS ${arg_DEPENDS} "${arg_SERVICE_XML}"
 
33
  )
 
34
  set(${arg_OUTFILES} ${${arg_OUTFILES}} "${CMAKE_CURRENT_BINARY_DIR}/${arg_NAME}.c" PARENT_SCOPE)
 
35
endfunction(add_gdbus_codegen)