Cmake build: Make QT5-compilation be default

(cherry picked from commit c971974f33)
This commit is contained in:
Kornel Benko 2024-04-06 12:36:47 +02:00 committed by Richard Kimberly Heck
parent 701c763221
commit 29282c1e13

View File

@ -662,23 +662,31 @@ endif()
set(min_qt5_version "5.6") set(min_qt5_version "5.6")
if(LYX_USE_QT MATCHES "AUTO") if(LYX_USE_QT MATCHES "AUTO")
# try qt6 first # try qt5 first
find_package(Qt6Core CONFIG QUIET)
if (Qt6Core_FOUND)
set(LYX_USE_QT "QT6" CACHE STRING "Valid qt version" FORCE)
message(STATUS "Qt6Core_VERSION = ${Qt6Core_VERSION}")
else()
find_package(Qt5Core CONFIG QUIET) find_package(Qt5Core CONFIG QUIET)
if(Qt5Core_FOUND) if(Qt5Core_FOUND)
set(LYX_USE_QT "QT5" CACHE STRING "Valid qt version" FORCE)
message(STATUS "Qt5Core_VERSION = ${Qt5Core_VERSION}") message(STATUS "Qt5Core_VERSION = ${Qt5Core_VERSION}")
if(Qt5Core_VERSION VERSION_LESS ${min_qt5_version}) if(Qt5Core_VERSION VERSION_LESS ${min_qt5_version})
message(FATAL_ERROR "No appropriate QT-version found") message(STATUS "No appropriate QT-version found")
endif() set(Qt5Core_FOUND OFF)
else() else()
message(FATAL_ERROR "No appropriate QT-version found") set(LYX_USE_QT "QT5" CACHE STRING "Valid qt version" FORCE)
set(Qt6Core_FOUND OFF)
endif() endif()
endif() endif()
if (NOT Qt5Core_FOUND)
foreach(_mod Core Gui Widgets Concurrent Svg)
find_package(Qt6${_mod} CONFIG QUIET)
if (NOT Qt6${_mod}_FOUND)
message(FATAL_ERROR "Not found Qt6${_mod}, aborting use of QT6")
set(Qt6Core_FOUND OFF)
break()
else()
message(STATUS "Found Qt6${_mod}")
endif()
endforeach()
set(LYX_USE_QT "QT6" CACHE STRING "Valid qt version" FORCE)
endif()
endif() endif()
# When shared libs are supported enable this option # When shared libs are supported enable this option