[CMake] How to write CMakeLists.txt for Qt4 when Q_OBJECT in xxx.cpp file

John Drescher drescherjm at gmail.com
Sat Jul 31 09:27:57 EDT 2010


> when use QT4_WRAP_CPP( Generated_MOC_SRCS main.cpp ),  moc_main.cxx
> will be generated.
> then I use #include "moc_main.cxx" instead of #include "main.moc"
>
> but ${Generated_MOC_SRCS}  can not be added to  ADD_EXECUTABLE.
> otherwise moc_main.cxx will be compiled too.
>

I am confused at the problem. I use the same method as Mike Jackson
does and it works fine for my private moc implementations.

John


More information about the CMake mailing list