Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED] CMake new macros for Qt5
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] CMake new macros for Qt5

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 1 Posters 6.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    goocreations
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goocreations
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved