Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Detect Qt version with CMake

Detect Qt version with CMake

Scheduled Pinned Locked Moved Unsolved Qt 6
2 Posts 2 Posters 802 Views
  • 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.
  • J Offline
    J Offline
    Jonas Kvinge
    wrote on 16 May 2021, 18:36 last edited by Jonas Kvinge
    #1

    According to the documentation (https://doc-snapshots.qt.io/qt6-dev/cmake-qt5-and-qt6-compatibility.html), the following should find Qt 6 first if available, then try Qt 5, however it does the opposite, it finds Qt 5 first:

    find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
    

    CMake 3.20.2
    Qt 6.1.0

    V 1 Reply Last reply 17 May 2021, 12:45
    0
    • J Jonas Kvinge
      16 May 2021, 18:36

      According to the documentation (https://doc-snapshots.qt.io/qt6-dev/cmake-qt5-and-qt6-compatibility.html), the following should find Qt 6 first if available, then try Qt 5, however it does the opposite, it finds Qt 5 first:

      find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)
      

      CMake 3.20.2
      Qt 6.1.0

      V Offline
      V Offline
      VRonin
      wrote on 17 May 2021, 12:45 last edited by VRonin
      #2

      @Jonas-Kvinge said in Detect Qt version with CMake:

      it does the opposite, it finds Qt 5 first

      I tested on windows and it actually finds the first one as listed in PATH. It's anyway a terrible idea to have multiple versions of Qt added to PATH at the same time

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3

      2/2

      17 May 2021, 12:45

      • Login

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