make KDE4_AUTOMOC compatible to qmake
Alexander Neundorf
neundorf at kde.org
Fri Jun 8 04:59:53 CEST 2007
On Wednesday 06 June 2007 12:57, Matthias Kretz wrote:
> Hi,
>
> today I learned that qmake apparently can work with #included moc files but
> only if they are of the form moc_<name>.cpp. But KDE4_AUTOMOC wants them as
> <name>.moc.
>
> In order to make it easier to switch from qmake to cmake (and back) I
> suggest the attached patch.
>
> There's one issue I don't understand yet: Why are the *.moc files (and with
> my patch the moc_*.cpp files) added to add_library/add_executable?
This is the official way to express the dependency of the target to the
generated files. If the files added this way to a target don't have a known
extension, they are not processed (compiled) but the dependency is created.
This doesn't work for generated files which are included in a source file AND
have a known extension (such as moc_foo.cpp).
Using OBJECT_DEPENDS works more or less, but not 100%. So, please don't commit
this and don't use this.
While it will work in many cases, it will not always work and introduce
problems.
I think there is currently no way to tell cmake not to compile a file with a
known extension. Even if this would be added for 2.4.7 or 2.4.8 it wouldn't
help us since we require 2.4.5.
IOW we have to stay with a non-source-file extension.
Bye
Alex
More information about the Kde-buildsystem
mailing list