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

John Drescher drescherjm at gmail.com
Sat Jul 31 11:08:30 EDT 2010


On Sat, Jul 31, 2010 at 10:50 AM, 1+1=2 <dbzhang800 at gmail.com> wrote:
> I want to use command like this:
>
> QT4_GENERATE_MOC(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp main.moc)
>
> but I do not know how to make this run before main.cpp being compiled to main.o
>
> anyone can help me?
>

Besides the fact that your syntax is wrong with your QT4_GENERATE_MOC
call the result of the moc has to be included in the target otherwise
it does not run.


John


More information about the CMake mailing list