RFC: new way to handle MOC files ?

Alexander Neundorf neundorf at kde.org
Sun Feb 23 22:07:58 GMT 2003

On Friday 21 February 2003 20:55, Michael Schuerig wrote:
> On Friday 21 February 2003 18:51, Alexander Neundorf wrote:
> > It works the following way: a moc file is required if a source or
> > header contains the Q_OBJECT macro. The create_global_moc script
> > parses all files given on its command line and searches checks which
> > files contain "Q_OBJECT". These files are remembered (e.g. foo.cpp)
> > and a new file "mocs.cpp" is created which will include all required
> > moc files (e.g. foo.cpp.moc).
> This means all moc files have to be recompiled when any header/source
> containing Q_OBJECT changes. Is that a good idea?
> Michael

I don't think that this would be a big problem.

But it would give two big advantages:

-possibility to explicitely recreate all moc files if something is fucked up 
in the build tree: I can remember that once when I tried to compile KDE 3.0 
the Makefiles were not able to rebuild the moc files, I could touch all *.h 
files and still they were not rebuild, when I deleted the moc files, they 
were not recreated, make force-reedit (which some said would help in this 
case) never worked here, and I'm not the only one experiencing such problems 
from time to time, see various mails on these mailinglists

-it enables you to write Makefiles for small Qt/KDE projects by hand without 
handcoding all the moc file rules (e.g. if you want to try something out and 
don't want to mess around with the automake/conf/etc stuff, but quickly hack 
something together)

And I think it would make the build process a little bit easier to understand.
You don't have to do *anything* in your sources to have the moc files created.

Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
Home: neundorf at kde.org                - http://www.kde.org
      alex at neundorf.net               - http://www.neundorf.net

More information about the kde-core-devel mailing list