aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt23
1 files changed, 19 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39b1b03a..9b53a53a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,9 +72,21 @@ message(STATUS " Header files will be installed to ${CMAKE_INSTALL_PREFIX}/${${
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC ON)
-find_package(Qt5 5.9 REQUIRED Core Network Gui Multimedia Test)
-get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE)
-message(STATUS "Using Qt ${Qt5_VERSION} at ${Qt5_Prefix}")
+option(BUILD_WITH_QT6 "Build Quotient with Qt 6" OFF)
+
+if (NOT BUILD_WITH_QT6)
+ # Use Qt5 by default
+ find_package(Qt5 5.12 QUIET COMPONENTS Core)
+endif()
+if (NOT Qt5Core_FOUND OR BUILD_WITH_Qt6)
+ find_package(Qt6 6.2 REQUIRED Core Network Gui Test) # TODO: Multimedia
+ set(Qt Qt6)
+else()
+ find_package(Qt5 5.12 REQUIRED Core Network Gui Multimedia Test)
+ set(Qt Qt5)
+endif()
+get_filename_component($Qt_Prefix "${${Qt}_DIR}/../../../.." ABSOLUTE)
+message(STATUS "Using Qt ${${Qt}_VERSION} at ${Qt_Prefix}")
if (${PROJECT_NAME}_ENABLE_E2EE)
if ((NOT DEFINED USE_INTREE_LIBQOLM OR USE_INTREE_LIBQOLM)
@@ -279,7 +291,10 @@ if (${PROJECT_NAME}_ENABLE_E2EE)
target_link_libraries(${PROJECT_NAME} QtOlm)
set(FIND_DEPS "find_dependency(QtOlm)") # For QuotientConfig.cmake.in
endif()
-target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia)
+target_link_libraries(${PROJECT_NAME} ${Qt}::Core ${Qt}::Network ${Qt}::Gui)
+if (Qt STREQUAL Qt5) # Qt 6 hasn't got Multimedia component as yet
+ target_link_libraries(${PROJECT_NAME} ${Qt}::Multimedia)
+endif()
configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX)