summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2013-05-13 18:01:41 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2013-05-13 18:01:41 +0200
commita35a5394b0eb3978bd114afe8f1b7ff69ad6af62 (patch)
tree5c3471a7719f61bb76f107bbd3bfeabf034b0a24 /CMakeLists.txt
parentdeed5778e82c6833d804730a514b93bbafea3040 (diff)
downloaduca-a35a5394b0eb3978bd114afe8f1b7ff69ad6af62.tar.gz
uca-a35a5394b0eb3978bd114afe8f1b7ff69ad6af62.tar.bz2
uca-a35a5394b0eb3978bd114afe8f1b7ff69ad6af62.tar.xz
uca-a35a5394b0eb3978bd114afe8f1b7ff69ad6af62.zip
Provide a macro for generating the enums
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 30 insertions, 0 deletions
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)