[CMake] Building a main.cpp containing a QObject subclass

Andreas Pakulat apaku at gmx.de
Mon Oct 31 08:59:48 EDT 2011


On 31.10.11 14:47:07, Laszlo Papp wrote:
> I am now attaching the log about the following files:
> 
> 1) CMakeLists.txt file
> 2) main.cpp
> 3) build log
> 4) moc_main.cxx
> 
> Q_MOC_OUTPUT_REVISION is somehow not defined, but not sure why.

You're not supposed to add the mocfiles variable contents you receive
from qt4_wrap_cpp to the list of sources. In particular not because you
already #include that same file in the main.cpp. If you look at the
generated file you'll notice that it requires all the declarations from
the main.cpp, i.e. its not a standalone C++ source and cannot be
compiled on its own.

Andreas



More information about the CMake mailing list