aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2006-07-04 08:55:38 +0000
committerDavid Faure <faure@kde.org>2006-07-04 08:55:38 +0000
commite5b714dceb2e5d405ef98a1375eed42234f13d52 (patch)
treee0ae04ee7dddbbebdf8832ba70599a6dd7e4cb55
parenta98eacc458a303f769590c6af4bfae6920845a51 (diff)
downloadextra-cmake-modules-e5b714dceb2e5d405ef98a1375eed42234f13d52.tar.gz
extra-cmake-modules-e5b714dceb2e5d405ef98a1375eed42234f13d52.tar.bz2
Let's stop generating adaptors that completely fail at runtime (qinvokemethod -> no compile-time checking).
QT4_ADD_DBUS_ADAPTORS is deprecated, use QT4_ADD_DBUS_ADAPTOR() instead, which now takes in its arguments the header file and the classname of the parent object being adapted. The methods in the adaptor simply call the methods in the parent object, which means we know at compile-time that the xml and the C++ match. This also shows that we can't generate adaptors at compile-time when the slots need the additional QDBusMessage argument; but that's probably a rare case. CCMAIL: kde-core-devel@kde.org svn path=/trunk/KDE/kdelibs/; revision=557871
-rw-r--r--modules/FindQt4.cmake47
1 files changed, 19 insertions, 28 deletions
diff --git a/modules/FindQt4.cmake b/modules/FindQt4.cmake
index 255ac425..caf8a3c5 100644
--- a/modules/FindQt4.cmake
+++ b/modules/FindQt4.cmake
@@ -38,22 +38,19 @@
# for all listed interface xml files
# the name will be automatically determined from the name of the xml file
#
-# macro QT4_ADD_DBUS_ADAPTOR(outfiles interface basename )
-# create a the adaptor header and implementation files with the
-# given basename from the given interface xml file and add it to
-# the list of sources
-#
-# macro QT4_ADD_DBUS_ADAPTORS(outfiles inputfile ... )
-# create the adaptor header and implementation files
-# for all listed interface xml files
-# the name will be automatically determined from the name of the xml file
+# macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname )
+# create a dbus adaptor (header and implementation file) from the xml file
+# describing the interface, and add it to the list of sources. The adaptor
+# forwards the calls to a parent class, defined in parentheader and named
+# parentclassname. The name of the generated files will be
+# <basename>adaptor.{cpp,h} where basename is the basename of the xml file.
#
# macro QT4_GENERATE_DBUS_INTERFACE( header)
# generate the xml interface file from the given header
#
# QT_FOUND If false, don't try to use Qt.
# QT4_FOUND If false, don't try to use Qt 4.
-#
+#
# QT_QTCORE_FOUND True if QtCore was found.
# QT_QTGUI_FOUND True if QtGui was found.
# QT_QT3SUPPORT_FOUND True if Qt3Support was found.
@@ -886,36 +883,30 @@ IF (QT4_QMAKE_FOUND)
ENDMACRO(QT4_GENERATE_DBUS_INTERFACE)
- MACRO(QT4_ADD_DBUS_ADAPTOR _sources _interface _basename)
- GET_FILENAME_COMPONENT(_infile ${_interface} ABSOLUTE)
-
+ MACRO(QT4_ADD_DBUS_ADAPTOR _sources _xml_file _include _parentClass)
+ GET_FILENAME_COMPONENT(_infile ${_xml_file} ABSOLUTE)
+ STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2adaptor" _basename ${_infile})
+ STRING(TOLOWER ${_basename} _basename)
+
SET(_header ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.h)
SET(_impl ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.cpp)
SET(_moc ${CMAKE_CURRENT_BINARY_DIR}/${_basename}.moc)
-
+
ADD_CUSTOM_COMMAND(OUTPUT ${_impl} ${_header}
- COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} ${_infile}
+ COMMAND ${QT_DBUSXML2CPP_EXECUTABLE} -m -a ${_basename} -i ${_include} -l ${_parentClass} ${_infile}
DEPENDS ${_infile}
)
-
+
QT4_GENERATE_MOC(${_header} ${_moc})
SET_SOURCE_FILES_PROPERTIES(${_impl} PROPERTIES SKIP_AUTOMOC TRUE)
MACRO_ADD_FILE_DEPENDENCIES(${_impl} ${_moc})
-
+
SET(${_sources} ${${_sources}} ${_impl} ${_header} ${_moc})
ENDMACRO(QT4_ADD_DBUS_ADAPTOR)
-
-
- MACRO(QT4_ADD_DBUS_ADAPTORS _sources)
- FOREACH (_current_FILE ${ARGN})
- GET_FILENAME_COMPONENT(_xml_file ${_current_FILE} ABSOLUTE)
- STRING(REGEX REPLACE "(.*[/\\.])?([^\\.]+)\\.xml" "\\2" _basename ${_current_FILE})
- STRING(TOLOWER ${_basename} _basename)
-
- QT4_ADD_DBUS_ADAPTOR(${_sources} ${_xml_file} ${_basename}adaptor)
- ENDFOREACH (_current_FILE ${ARGN})
- ENDMACRO(QT4_ADD_DBUS_ADAPTORS)
+ MACRO(QT4_ADD_DBUS_ADAPTORS _sources)
+ message(FATAL_ERROR "There is a call to QT4_ADD_DBUS_ADAPTORS() in the CMakeLists.txt for '${ARGV0}', but this macro has been removed, please use QT4_ADD_DBUS_ADAPTOR and specify the include file and classname for the parent object implementing the code")
+ ENDMACRO(QT4_ADD_DBUS_ADAPTORS _sources)
MACRO(QT4_AUTOMOC)
QT4_GET_MOC_INC_DIRS(_moc_INCS)