[SOLVED] CMake new macros for Qt5
-
I've noticed that there are some cool new macros in CMake 2.8.8 for Qt5. I've followed the example on "http://doc-snapshot.qt-project.org/5.0/cmake-manual.html":http://doc-snapshot.qt-project.org/5.0/cmake-manual.html but am a little bit confused about linking to my own libraries. I have a library linking to QtCore and an executable linking to my library and QtGui. The old way is as follows:
@target_link_libraries(MyLibrary ${Qt5Core_LIBRARIES})
target_link_libraries(MyExecutable MyLibrary ${Qt5Gui_LIBRARIES})@The new way (if I understand correclt), is as follows:
@qt5_use_modules(MyLibrary Core)
target_link_libraries(MyExecutable MyLibrary)
qt5_use_modules(MyExecutable Gui)@When I do this, my linker gives me a lot "undefined reference" and "vtable" errors for my classes in MyLibrary.
Do I have to handle the linking of MyLibrary to MyExectuable in a new or different manner? -
Found the problem. The above code should work. My fault was using QT_WRAP_CPP instead of QT5_WRAP_CPP. Seems like moccing in Qt4 and Qt5 is different. But there is auto-moccing functionality in the new version of CMake, so will use that in any way.