From a35a5394b0eb3978bd114afe8f1b7ff69ad6af62 Mon Sep 17 00:00:00 2001 From: Matthias Vogelgesang Date: Mon, 13 May 2013 18:01:41 +0200 Subject: Provide a macro for generating the enums --- CMakeLists.txt | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b5f435..1dac9e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,36 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/package.sh.in add_definitions("-std=c99 -Wall") +# --- Common macros + +# create_enums +# @prefix: prefix of the output enum files +# @template_prefix: prefix of the template (should be src/uca-enums) +# @header_list: list with header files that should be searched for enums +macro(create_enums prefix template_prefix header_list) + ${CMAKE_CURRENT_SOURCE_DIR}") + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h + COMMAND ${GLIB2_MKENUMS} + ARGS + --template ${template_prefix}.h.template + ${header_list} > ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${header_list}) + + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.c + COMMAND ${GLIB2_MKENUMS} + ARGS + --template ${template_prefix}.c.template + ${header_list} > ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.c + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + DEPENDS ${header_list} + ${CMAKE_CURRENT_BINARY_DIR}/${prefix}.h + ) +endmacro() + + # --- Common libraries -------------------------------------------------------- set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) -- cgit v1.2.3