diff options
author | Volker Krause <vkrause@kde.org> | 2006-05-31 12:52:30 +0000 |
---|---|---|
committer | Volker Krause <vkrause@kde.org> | 2006-05-31 12:52:30 +0000 |
commit | 117cb4d48ba9c4618c3bf71f7cb8799e1b189d34 (patch) | |
tree | 84f461f6c0603e3abfd72b952b9124853aedd5b1 | |
parent | d9f94a32176bb09c5397ca12033c555929ad1acf (diff) | |
download | extra-cmake-modules-117cb4d48ba9c4618c3bf71f7cb8799e1b189d34.tar.gz extra-cmake-modules-117cb4d48ba9c4618c3bf71f7cb8799e1b189d34.tar.bz2 |
Add macro to generate QDBus interfaces from XML descriptions.
svn path=/trunk/KDE/kdelibs/; revision=546931
-rw-r--r-- | modules/FindQtDBus.cmake | 12 | ||||
-rw-r--r-- | modules/QtDBusMacros.cmake | 22 |
2 files changed, 34 insertions, 0 deletions
diff --git a/modules/FindQtDBus.cmake b/modules/FindQtDBus.cmake index 937ab333..ae17513e 100644 --- a/modules/FindQtDBus.cmake +++ b/modules/FindQtDBus.cmake @@ -6,6 +6,13 @@ # QDBUS_LIBRARIES - Link these to use QtDBus # QDBUS_DEFINITIONS - Compiler switches required for using QtDBus # +# QDBUS_IDL2CPP_EXECUTABLE - The adaptor/interface code generator +# QDBUS_CPP2XML_EXECUTABLE - The interface parser +# +# Macros (from QtDBusMacros.cmake): +# QDBUS_ADD_INTERFACES(SRC_VAR file1.xml ... fileN.xml) +# Generates interface code from the given XML files. +# # use pkg-config to get the directories and then use these values @@ -37,3 +44,8 @@ else (QDBUS_FOUND) message(STATUS "See also the PORTING-TO-DBUS.txt file in kdelibs/") message(FATAL_ERROR "Could NOT find QtDBus") endif (QDBUS_FOUND) + +find_program(QDBUS_IDL2CPP_EXECUTABLE NAME dbusidl2cpp PATHS) +find_program(QDBUS_CPP2XML_EXECUTABLE NAME dbuscpp2xml PATHS) + +include( QtDBusMacros ) diff --git a/modules/QtDBusMacros.cmake b/modules/QtDBusMacros.cmake new file mode 100644 index 00000000..5ee785db --- /dev/null +++ b/modules/QtDBusMacros.cmake @@ -0,0 +1,22 @@ +# +# QtDBus macros, documentation see FindQtDBus.cmake +# + +macro(qdbus_add_interfaces _sources) + foreach (_i ${ARGN}) + get_filename_component(_xml_file ${_i} ABSOLUTE) + get_filename_component(_basename ${_i} NAME_WE) + set(_target_base ${CMAKE_CURRENT_BINARY_DIR}/${_basename}) + + add_custom_command(OUTPUT ${_target_base}.cpp ${_target_base}.h + COMMAND ${QDBUS_IDL2CPP_EXECUTABLE} + ARGS -m -p ${_basename} ${_xml_file} + DEPENDS ${_xml_file} + ) + + qt4_generate_moc(${_target_base}.h ${_target_base}.moc) + macro_add_file_dependencies(${_target_base}.h ${_target_base}.moc ) + + set(${_sources} ${${_sources}} ${_target_base}.cpp) + endforeach (_i ${ARGN}) +endmacro(qdbus_add_interfaces) |