2018-09-18 12:07:33 +02:00
|
|
|
add_library(3rdparty_qt5 INTERFACE)
|
|
|
|
|
2020-03-22 00:26:40 +01:00
|
|
|
find_package(Qt5 5.14 CONFIG COMPONENTS Widgets Concurrent)
|
2018-09-18 12:07:33 +02:00
|
|
|
if(WIN32)
|
2020-02-10 17:57:23 +01:00
|
|
|
find_package(Qt5 5.14 COMPONENTS WinExtras REQUIRED)
|
2020-03-22 00:26:40 +01:00
|
|
|
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::WinExtras Qt5::Concurrent)
|
2018-09-18 12:07:33 +02:00
|
|
|
else()
|
2020-02-10 17:57:23 +01:00
|
|
|
find_package(Qt5 5.14 COMPONENTS DBus Gui)
|
2018-09-18 12:07:33 +02:00
|
|
|
if(Qt5DBus_FOUND)
|
2020-03-22 00:26:40 +01:00
|
|
|
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::DBus Qt5::Concurrent)
|
2018-09-18 12:07:33 +02:00
|
|
|
target_compile_definitions(3rdparty_qt5 INTERFACE -DHAVE_QTDBUS)
|
|
|
|
else()
|
2020-03-22 00:26:40 +01:00
|
|
|
target_link_libraries(3rdparty_qt5 INTERFACE Qt5::Widgets Qt5::Concurrent)
|
2018-09-18 12:07:33 +02:00
|
|
|
endif()
|
|
|
|
target_include_directories(3rdparty_qt5 INTERFACE ${Qt5Gui_PRIVATE_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT Qt5Widgets_FOUND)
|
2020-02-10 17:57:23 +01:00
|
|
|
if(Qt5Widgets_VERSION VERSION_LESS 5.14.0)
|
|
|
|
message("Minimum supported Qt5 version is 5.14.0! You have version ${Qt5Widgets_VERSION} installed, please upgrade!")
|
2018-09-18 12:07:33 +02:00
|
|
|
if(CMAKE_SYSTEM MATCHES "Linux")
|
|
|
|
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.
|
2020-02-10 17:57:23 +01:00
|
|
|
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.14.1-bionic
|
|
|
|
https://launchpad.net/~beineri/+archive/ubuntu/opt-qt-5.14.1-xenial
|
2018-09-18 12:07:33 +02:00
|
|
|
just make sure to run
|
2020-02-10 17:57:23 +01:00
|
|
|
source /opt/qt514/bin/qt514-env.sh
|
2018-09-18 12:07:33 +02:00
|
|
|
before re-running cmake")
|
|
|
|
elseif(WIN32)
|
|
|
|
message(FATAL_ERROR "You can download the latest version of Qt5 here: https://www.qt.io/download-open-source/")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Look online for instructions on installing an up-to-date Qt5 on ${CMAKE_SYSTEM}.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message("CMake was unable to find Qt5!")
|
|
|
|
if(WIN32)
|
2020-02-10 17:57:23 +01:00
|
|
|
message(FATAL_ERROR "Make sure the QTDIR env variable has been set properly. (for example C:\\Qt\\5.14.1\\msvc2017_64\\)
|
2019-10-26 04:19:07 +02:00
|
|
|
You can also try setting the Qt5_DIR preprocessor definiton.")
|
2018-09-18 12:07:33 +02:00
|
|
|
elseif(CMAKE_SYSTEM MATCHES "Linux")
|
|
|
|
message(FATAL_ERROR "Make sure to install your distro's qt5 package!")
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "You need to have Qt5 installed, look online for instructions on installing Qt5 on ${CMAKE_SYSTEM}.")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_library(3rdparty::qt5 ALIAS 3rdparty_qt5)
|