[Development] Announcing moc_combine

Thiago Macieira thiago.macieira at intel.com
Tue May 31 20:29:45 CEST 2016


On terça-feira, 31 de maio de 2016 15:14:41 BRT Thiago Macieira wrote:
> On terça-feira, 31 de maio de 2016 14:42:01 BRT Thiago Macieira wrote:
> > Also, qmake would need to list only the actual headers, not the indirect
> > dependencies of them as it currently does. That would mean moc would not
> > get  rerun if an indirect dependency of a header changed. In Qt 4, that
> > wasn't a problem; for Qt 5, given that moc parses plugin and metatype
> > declarations from included headers, the rerun would not produce the same
> > as
> > a clean build.
> But it suffers from the problem of indirect dependencies, which I don't know
> how to solve:
> 
> $ gmake
> gmake: Nothing to be done for 'mocables'.
> $ touch indirect1.h
> $ gmake
> gmake: Nothing to be done for 'mocables'.

The following extra rules solve the problem, at the expense of causing Qt 
Creator to complain that the header you had opened changed every time you 
build:

1.h: indirect1.h
	@touch $@
2.h: indirect2.h
	@touch $@
indirect1.h: indirect1-1.h
	@touch $@

Proof:
$ gmake
moc --combine=%.h=.moc/moc_%.cpp 1.h 2.h
$ touch indirect2.h 
$ gmake
moc --combine=%.h=.moc/moc_%.cpp 2.h
$ touch indirect1-1.h 
$ gmake              
moc --combine=%.h=.moc/moc_%.cpp 1.h

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list