[build2] Build system module for code-generation utilities Qt moc, etc

Boris Kolpackov boris at codesynthesis.com
Thu Oct 3 14:16:57 UTC 2019


[Adding Sam Schweigel who was interested[1] in this as well.]

Patrick Fromberg <patrick.fromberg at gmail.com> writes:

> The discussion was about how detecting which files in a Qt project require
> calling MOC on them before compiling.
> 
> Such cpp files are hundred percent c++ files from the compiler's point of
> view. However those files are actually not exactly cpp files. They have some
> additional information for moc "secretly" encoded in c++.

I am a bit confused: is it source files (.cpp), header files (.hpp), or
both that may need to be processed by MOC?


> I don't think this is a bad thing ( I actually like MOC ) but would it not
> make sense to give those files a different file name ending?

It will probably help a bit since now you know exactly what you need to
process with MOC.

In build2 we can achieve the same with target types but then you won't
be able to use wildcard patters, which are very handy, I must say.

> If there is a strong argument for this different file name ending ( not just
> from the point of view of build2 ) then the Qt team may even adopt this.

Hm, unless this is coming from the Qt team itself, I somewhat doubt it:
lots of tooling (build systems, IDEs/editors, static analyzers, etc) will
have to be taught about these new C++ source/header file extensions.

The C++ community is currently having the same debate about a separate
extension for module interface files and while I think the rationale is
a lot stronger, there is still a lot of push back.

[1] https://lists.build2.org/archives/users/2019-May/000631.html



More information about the users mailing list