make KDE4_AUTOMOC compatible to qmake

Thiago Macieira thiago at kde.org
Tue Jun 26 16:03:33 CEST 2007


David Faure wrote:
>On Tuesday 26 June 2007, Thiago Macieira wrote:
>> Matthias Kretz wrote:
>> >don't have David's mail here for replying to it...
>> >
>> >but attached is a patch to create the .moc file from the .cpp file if
>> > the .cpp file matches ^\s*Q_OBJECT. For moc_foo.cpp files it always
>> > creates it from the .h file. That way you can include both
>> >#include "moc_foo.cpp"
>> >#include "foo.moc"
>> >
>> >and with that include the moc generated code from the .cpp and the .h
>> > files. (If I understood correctly that's compatible with qmake.)
>>
>> *.cpp files must not be included. They must be compiled on their own.
>>
>> Only *.moc files should be included.
>
>You're talking about qmake? I tested with foo.cpp including both
> moc_foo.cpp and foo.moc (when both foo.cpp and foo.h have a Q_OBJECT)
> and it worked fine.

No, I'm talking about us. We shouldn't include other .cpp files.

It's a lot easier to write rules when you can do wildcard matching.

>But I guess that doesn't prove much, I might have been linking
> moc_foo.cpp twice into the binary?

If you had, you'd get linker errors.

-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20070626/f696a1ed/attachment.pgp 


More information about the Kde-buildsystem mailing list