diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2010-09-18 19:47:33 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2010-09-19 19:12:36 +0200 |
commit | 2dd5dbaf67c7d842b5120899a70cd09bcbd8d804 (patch) | |
tree | d733f9a0d8271242a52af4fc7a5aedd7f35a41cc | |
parent | b66704114ef4888c0538919d9027a5f7889813de (diff) | |
download | logdiag-2dd5dbaf67c7d842b5120899a70cd09bcbd8d804.tar.gz logdiag-2dd5dbaf67c7d842b5120899a70cd09bcbd8d804.tar.xz logdiag-2dd5dbaf67c7d842b5120899a70cd09bcbd8d804.zip |
Automatized generation of marshallers.
-rw-r--r-- | CMakeLists.txt | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e42d8ca..b7b1828 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -100,6 +100,35 @@ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) include_directories (${CMAKE_CURRENT_BINARY_DIR}) +# Generate marshallers +function (glib_genmarshal base prefix) + find_program (GLIB_GENMARSHAL_EXECUTABLE glib-genmarshal) + + if (GLIB_GENMARSHAL_EXECUTABLE) + get_filename_component (base_path "${base}" PATH) + get_filename_component (base_name "${base}" NAME) + set (command_base ${GLIB_GENMARSHAL_EXECUTABLE} + --prefix ${prefix} "${base_name}.list") + + # NOTE: VERBATIM may cause problems, so it is not used here + add_custom_command (OUTPUT ${base}.c + COMMAND ${command_base} --body > "${base_name}.c" + DEPENDS "${base}.list" + WORKING_DIRECTORY "${base_path}" + COMMENT "Generating marshallers source file") + add_custom_command (OUTPUT ${base}.h + COMMAND ${command_base} --header > "${base_name}.h" + DEPENDS "${base}.list" + WORKING_DIRECTORY "${base_path}" + COMMENT "Generating marshallers header file") + else (GLIB_GENMARSHAL_EXECUTABLE) + message (WARNING "glib-genmarshal is not present on this system") + endif (GLIB_GENMARSHAL_EXECUTABLE) +endfunction (glib_genmarshal) + +glib_genmarshal (${CMAKE_CURRENT_SOURCE_DIR}/src/ld-marshal + g_cclosure_user_marshal) + # Build the executable include_directories (${GTK2_INCLUDE_DIRS}) add_executable (logdiag ${logdiag_SOURCES} ${logdiag_HEADERS}) |