Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMake: how to get find_package to work with different versions of Qt?

CMake: how to get find_package to work with different versions of Qt?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 512 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.
  • idlefrogI Offline
    idlefrogI Offline
    idlefrog
    wrote on last edited by idlefrog
    #1

    I have a project that needs to support Qt4.8 and Qt5, and build with CMake.
    In my CMake I have:

    find_package(Qt5 COMPONENTS Core Gui Widget Xml REQUIRED)
    

    But how do I generalise this so that it will work with either Qt4 or 5?
    (Our build pipeline has one machine with Qt4 installed, and another with 5).

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You might be able to do something along the lines of the version less cmake targets used for Qt 5 and 6.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      idlefrogI 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        You might be able to do something along the lines of the version less cmake targets used for Qt 5 and 6.

        idlefrogI Offline
        idlefrogI Offline
        idlefrog
        wrote on last edited by
        #3

        @SGaist Thank you! That might do the job. Will need to experiment with it.

        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