[CMake] question about QT4_WRAP_CPP
Glenn Hughes
ghughes02138 at gmail.com
Mon Dec 7 17:54:29 EST 2009
I'm still playing around with the states Qt example, and I've hit something
I don't understand:
I can get everything working as expected with QT4_AUTOMOC, but not if I use
QT4_WRAP_CPP.
In the QT4_WRAP_CPP case, it seems the only way to get dependencies set up
correctly is to add the MOC output to the target, i.e.
QT4_WRAP_CPP( states_MOC_files ${states_HEADERS})
ADD_EXECUTABLE( states MACOSX_BUNDLE ${states_SRCS} ${states_MOC_files}
${states_RESOURCES_SOURCES} )
However, if I do this CMake adds the moc files (named in the form
moc_foo.cxx) to the project to be compiled as C++ files.
BUT, MOC files are not designed to be compiled on their own. Typically they
are included at the bottom of the module that contains the source for the
objects in question. They do not include all the headers that they need, and
so they will not build independently.
So, if I include the moc files in the ADD_EXECUTABLE line, my build doesn't
work...
but if I remove them, the dependency is not set up, so the moc files are not
generated at all.
How can I say "these files are required by this target, but don't try to
compile them directly?"
Or is there something else I should be doing?
Thanks in advance
Glenn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20091207/72e8fa46/attachment.htm>
More information about the CMake
mailing list