I don't know the effect of QT4_AUTOMOC call but in CMake docs I've found
macro QT4_AUTOMOC(sourcefile1 sourcefile2 ... )
This macro is still experimental.
It can be used to have moc automatically handled.
So if you have the files foo.h and foo.cpp, and in foo.h a
a class uses the Q_OBJECT macro, moc has to run on it. If you don't
want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
#include "foo.moc"
in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the
scan all listed files at cmake-time for such included moc files and if it finds
them cause a rule to be generated to run moc at build time on the
accompanying header file foo.h.
If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro.
You have to put
Qt Code:
  1. #include "widget.moc"
To copy to clipboard, switch view to plain text mode 
in the widget.cpp file and remove widget.h as parameter of QT4_AUTOMOC

See http://http://wiki.qtcentre.org/inde...pps_with_CMake
that suggest the use of QT4_WRAP_CPP instead of QT4_AUTOMOC.

In your widget.h file you have to insert
Qt Code:
  1. #ifndef _WIDGET_H_
To copy to clipboard, switch view to plain text mode 
as first line and
Qt Code:
  1. #endif // _WIDGET_H_
To copy to clipboard, switch view to plain text mode 
as last line of code