~unity8-desktop-session-team/indicator-session/indicator-session-using-upstart

384.2.5 by Charles Kerr
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.
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)