aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt23
-rw-r--r--autotests/CMakeLists.txt2
-rw-r--r--quotest/CMakeLists.txt2
3 files changed, 21 insertions, 6 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)
diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
index 07f1f046..282ab036 100644
--- a/autotests/CMakeLists.txt
+++ b/autotests/CMakeLists.txt
@@ -7,7 +7,7 @@ include(CMakeParseArguments)
function(QUOTIENT_ADD_TEST)
cmake_parse_arguments(ARG "" "NAME" "" ${ARGN})
add_executable(${ARG_NAME} ${ARG_NAME}.cpp)
- target_link_libraries(${ARG_NAME} Qt5::Core Qt5::Test Quotient)
+ target_link_libraries(${ARG_NAME} ${Qt}::Core ${Qt}::Test Quotient)
add_test(NAME ${ARG_NAME} COMMAND ${ARG_NAME})
endfunction()
diff --git a/quotest/CMakeLists.txt b/quotest/CMakeLists.txt
index 29c53fae..bf9af796 100644
--- a/quotest/CMakeLists.txt
+++ b/quotest/CMakeLists.txt
@@ -5,7 +5,7 @@
set(quotest_SRCS quotest.cpp)
add_executable(quotest ${quotest_SRCS})
-target_link_libraries(quotest PRIVATE Qt5::Core Qt5::Test ${PROJECT_NAME})
+target_link_libraries(quotest PRIVATE ${Qt}::Core ${Qt}::Test ${PROJECT_NAME})
option(${PROJECT_NAME}_INSTALL_TESTS "install quotest (former qmc-example) application" ON)
add_feature_info(InstallQuotest ${PROJECT_NAME}_INSTALL_TESTS