1
cmake_minimum_required(VERSION 2.6)
3
cmake_policy(SET CMP0011 NEW)
6
find_program(GDBUS_CODEGEN NAMES gdbus-codegen DOC "gdbus-codegen executable")
8
message(FATAL_ERROR "Excutable gdbus-codegen not found")
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})
17
set(PREFIX --interface-prefix ${arg_PREFIX})
21
set(NAMESPACE --c-namespace ${arg_NAMESPACE})
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}"
31
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
32
DEPENDS ${arg_DEPENDS} "${arg_SERVICE_XML}"
34
set(${arg_OUTFILES} ${${arg_OUTFILES}} "${CMAKE_CURRENT_BINARY_DIR}/${arg_NAME}.c" PARENT_SCOPE)
35
endfunction(add_gdbus_codegen)