CMake: Update required Qt version

This commit is contained in:
JohnHolmesII 2020-12-29 16:14:55 -08:00 committed by Ivan
parent c952e99f3e
commit 9c3e55787e

20
3rdparty/qt5.cmake vendored
View File

@ -1,11 +1,13 @@
add_library(3rdparty_qt5 INTERFACE) add_library(3rdparty_qt5 INTERFACE)
find_package(Qt5 5.14 CONFIG COMPONENTS Widgets Concurrent) set(QT_MIN_VER 5.15.2)
find_package(Qt5 ${QT_MIN_VER} CONFIG COMPONENTS Widgets Concurrent)
if(WIN32) if(WIN32)
find_package(Qt5 5.14 COMPONENTS WinExtras REQUIRED) find_package(Qt5 ${QT_MIN_VER} COMPONENTS WinExtras REQUIRED)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::WinExtras Qt5::Concurrent) target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::WinExtras Qt5::Concurrent)
else() else()
find_package(Qt5 5.14 COMPONENTS DBus Gui) find_package(Qt5 ${QT_MIN_VER} COMPONENTS DBus Gui)
if(Qt5DBus_FOUND) if(Qt5DBus_FOUND)
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::DBus Qt5::Concurrent) target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::DBus Qt5::Concurrent)
target_compile_definitions(3rdparty_qt5 INTERFACE -DHAVE_QTDBUS) target_compile_definitions(3rdparty_qt5 INTERFACE -DHAVE_QTDBUS)
@ -16,16 +18,12 @@ else()
endif() endif()
if(NOT Qt5Widgets_FOUND) if(NOT Qt5Widgets_FOUND)
if(Qt5Widgets_VERSION VERSION_LESS 5.14.0) if(Qt5Widgets_VERSION VERSION_LESS ${QT_MIN_VER})
message("Minimum supported Qt5 version is 5.14.0! You have version ${Qt5Widgets_VERSION} installed, please upgrade!") message("Minimum supported Qt5 version is ${QT_MIN_VER}! You have version ${Qt5Widgets_VERSION} installed, please upgrade!")
if(CMAKE_SYSTEM MATCHES "Linux") if(CMAKE_SYSTEM MATCHES "Linux")
message(FATAL_ERROR "Most distros do not provide an up-to-date version of Qt. message(FATAL_ERROR "Most distros do not provide an up-to-date version of Qt.
If you're on Ubuntu or Linux Mint, there are PPAs you can use to install one of the latest qt5 versions. If you're on Ubuntu or Linux Mint, there are PPAs you can use to install one of the latest qt5 versions.
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.14.1-bionic Find the correct ppa at https://launchpad.net/~beineri and follow the instructions.")
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.14.1-xenial
just make sure to run
source /opt/qt514/bin/qt514-env.sh
before re-running cmake")
elseif(WIN32) elseif(WIN32)
message(FATAL_ERROR "You can download the latest version of Qt5 here: https://www.qt.io/download-open-source/") message(FATAL_ERROR "You can download the latest version of Qt5 here: https://www.qt.io/download-open-source/")
else() else()
@ -35,7 +33,7 @@ before re-running cmake")
message("CMake was unable to find Qt5!") message("CMake was unable to find Qt5!")
if(WIN32) if(WIN32)
message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\5.14.1\\msvc2017_64\\) message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\${QT_MIN_VER}\\msvc2019_64\\)
You can also try setting the Qt5_DIR preprocessor definiton.") You can also try setting the Qt5_DIR preprocessor definiton.")
elseif(CMAKE_SYSTEM MATCHES "Linux") elseif(CMAKE_SYSTEM MATCHES "Linux")
message(FATAL_ERROR "Make sure to install your distro's qt5 package!") message(FATAL_ERROR "Make sure to install your distro's qt5 package!")