Need help with custom moc commands.

Alexander Neundorf neundorf at kde.org
Fri Apr 28 18:07:47 CEST 2006


On Friday 28 April 2006 14:46, Michaël Larouche wrote:
> (Please CC to me as I am not a member of kde-buildsystem)
>
> In Kopete (kdenetwork/kopete/protocols/jabber/libiris to be more precise),
> I have some files where both header and implementation has the Q_OBJECT.
>
> The Makefile.am used this trick:
>
> s5b.lo: s5b.moc
>
> CLEANFILES = s5b.moc
> s5b.moc: $(srcdir)/s5b.cpp $(srcdir)/s5b.h
> 	${MOC} $(srcdir)/s5b.h > $@
> 	${MOC} $(srcdir)/s5b.cpp >> $@

I don't think that this is a good idea.
Doesn't this give a cyclic dependency ?
s5b.moc depends on s5b.cpp, and s5b.cpp depends on s5b.moc because it includes 
it ?

I'd suggest:

kde4_automoc( ${libiris_SRCS} )
qt4_wrap_cpp(libiris_SRCS s5b.cpp securestream.cpp )

This should just work. It will generate the moc stuff for the s5b.h and 
securestream.h header which can be included and should generate extra moc 
files for s5b.cpp and securestream.cpp, which will be compiled and linked as 
separate files.
And it should avoid the cyclic dependency.


Bye
Alex
-- 
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-buildsystem mailing list