Hello Gergely, * Gergely Risko wrote on Thu, Jul 09, 2009 at 01:16:19PM CEST: > I've patched automake to include support for Qt's MOC. I've introduced > a new prog_QTSOURCES variable for the user to specify the Qt based > sources. I've modified the texinfo documentation, added tests.
Thank you for doing all of this work! First off, I haven't looked at it at all yet. Also, I don't want to discourage you either, but still: I've found using moc to be quite trivial without any large changes to Automake at all. We use it in one of our projects like this: configure.ac uses macros from pkg.m4 and bnv_have_qt.m4 for QT3: AC_MSG_CHECKING([for pkgconfig/qt-mt]) PKG_CHECK_MODULES(QT, [qt-mt >= 3.1], [CPPFLAGS="$CPPFLAGS $QT_CFLAGS" LIBS="$QT_LIBS $LIBS" AC_PATH_PROG([MOC], [moc], [:])], [# We need thread support in QT. CPPFLAGS="$CPPFLAGS -DQT_THREAD_SUPPORT" BNV_HAVE_QT CPPFLAGS="$CPPFLAGS $QT_CXXFLAGS" LIBS="$QT_LIBS $LIBS" MOC="$QT_MOC"]) The external macros come from pkg-config and from the Autoconf Macro Archive; the BNV_HAVE_QT still has some minor bugs I need to report. Makefile.am uses something like this: bin_PROGRAMS = foo ... foo_SOURCES = \ $(foo_moc_in_sources) \ $(foo_moc_sources) \ foo_other_sources.cpp \ foo_other_sources.h ... foo_moc_sources = $(foo_moc_in_sources:.h=.moc) foo_moc_in_sources = \ header.h \ ... SUFFIXES = .cpp .moc .h .h.moc: $(MOC) -i $< -o $@ The *.cpp files typically include the *.moc file at the end. The automatic dependency tracking will record the dependencies upon the .moc files. For QT4, one needs to adjust the configure.ac stuff (I still need to finish my work on this and feedback to the bnv_have_qt.m4 authors), and add e.g. $(CPPFLAGS) to the $(MOC) command line. Also, as an example, you can use something like $PKG_CONFIG --variable=moc_location QtCore to detect the moc that comes with a QT4 install. Hope that helps any. It might be a couple of weeks until I have time to look at this any further. Cheers, Ralf