On 10/02/2010 09:07 AM, Laszlo Papp wrote: > Hi, > > I wrote a helloworld class, source and header file for instance which > is basically moc related class with Q_OBJECT macro. I do not know why > I must use qt4_wrap_cpp(helloworld.h) beside > qt4_automoc(helloworld.cpp).
There's no need to use both. > I always thought that qt4_automoc can recognize it. I would like to > avoid the moc file include at the end of my source line. I would like > to link that generated moc at linkage time, mostly. With QT4_AUTOMOC(), you must include the generated moc files in your sources, but with QT4_WRAP_CPP(), you can do, e.g., the following: SET(HEADERS helloworld.h) SET(SOURCES main.cpp helloworld.cpp) QT4_WRAP_CPP(SOURCES ${HEADERS}) ADD_EXECUTABLE(main ${SOURCES} ${HEADERS}) TARGET_LINK_LIBRARIES(main ${QT_LIBRARIES}) So, the generated moc files are compiled and linked along with the usual source files, and it's not necessary to include them anywhere. Regards, Michael _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake