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. QT NAMES Qt6 Qt5 COMPONENTS Core Core5Compat not working
Forum Updated to NodeBB v4.3 + New Features

QT NAMES Qt6 Qt5 COMPONENTS Core Core5Compat not working

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.2k 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.
  • X Offline
    X Offline
    xavierbaez
    wrote on last edited by
    #1

    Hello

    the QT_MAJOR_VERSION is failing.
    It's detecting Qt5 but I want Qt6

    Here is the code CMakeLists.txt:

    set(CMAKE_INCLUDE_CURRENT_DIR  ON)
    
    set(CMAKE_AUTOUIC ON)
    set(CMAKE_AUTOMOC ON)
    set(CMAKE_AUTORCC ON)
    
    set(CMAKE_CXX_STANDARD 17)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    
    
    find_package(QT NAMES Qt6 Qt5 COMPONENTS Core Core5Compat REQUIRED)
    find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Core5Compat Network Gui Qml REQUIRED)
    
    target_link_libraries(${PROJECT_NAME} PUBLIC Qt${QT_VERSION_MAJOR}::Qt5Compat)
    

    Here is the error

    CMake Error at /usr/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package):
      Could not find a package configuration file provided by "Qt5Core5Compat"
    

    I have Arch Linux.
    Here are the packages I have:

    pacman -Q | grep -i qt6
    qt6-5compat 6.4.3-1
    qt6-base 6.4.3-1
    qt6-declarative 6.4.3-1
    qt6-multimedia 6.4.3-1
    qt6-multimedia-ffmpeg 6.4.3-1
    qt6-positioning 6.4.3-1
    qt6-quick3d 6.4.3-1
    qt6-quicktimeline 6.4.3-1
    qt6-serialport 6.4.3-1
    qt6-shadertools 6.4.3-1
    qt6-svg 6.4.3-1
    qt6-tools 6.4.3-1
    qt6-translations 6.4.3-1
    qt6-webchannel 6.4.3-1
    qt6-webengine 6.4.3-1
    
    1 Reply Last reply
    0
    • D Offline
      D Offline
      Diego Iastrubni
      wrote on last edited by
      #2

      @xavierbaez said in QT NAMES Qt6 Qt5 COMPONENTS Core Core5Compat not working:

      CMake Error at /usr/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package):

      You also have Qt5 - and that is getting picked by cmake. You need to "ifdef core5compat".

      See this:

      if (Qt6_FOUND)
          find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
      endif()
      

      Do you really need Qt5 support? If you work "hard enough", you can also have qt4 support.. .but, is it worth it?

      X 1 Reply Last reply
      0
      • D Diego Iastrubni

        @xavierbaez said in QT NAMES Qt6 Qt5 COMPONENTS Core Core5Compat not working:

        CMake Error at /usr/lib/cmake/Qt5/Qt5Config.cmake:28 (find_package):

        You also have Qt5 - and that is getting picked by cmake. You need to "ifdef core5compat".

        See this:

        if (Qt6_FOUND)
            find_package(Qt6 REQUIRED COMPONENTS Core5Compat)
        endif()
        

        Do you really need Qt5 support? If you work "hard enough", you can also have qt4 support.. .but, is it worth it?

        X Offline
        X Offline
        xavierbaez
        wrote on last edited by
        #3

        @Diego-Iastrubni okay I will try that
        But it’s supposed to pick up MAJOR and MINOR

        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