QT NAMES Qt6 Qt5 COMPONENTS Core Core5Compat not working
-
Hello
the QT_MAJOR_VERSION is failing.
It's detecting Qt5 but I want Qt6Here 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
-
@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?
-
@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?
@Diego-Iastrubni okay I will try that
But it’s supposed to pick up MAJOR and MINOR