Skip to content

Commit 7a56c36

Browse files
3nidsm-kuhn
authored andcommittedMar 25, 2021
[qt6] CMake build adjustments for qt6
1 parent 8e8febb commit 7a56c36

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed
 

‎CMakeLists.txt

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,17 @@ if(WITH_CORE)
451451
endif()
452452

453453
find_package(${QT_VERSION_BASE} COMPONENTS Core Gui Widgets Network Xml Svg Concurrent Test UiTools Sql REQUIRED)
454+
if (WITH_QT6)
455+
find_package(${QT_VERSION_BASE} COMPONENTS Core5Compat REQUIRED)
456+
else()
457+
# TODO only available starting from Qt 6.2
458+
find_package(${QT_VERSION_BASE} COMPONENTS Positioning)
459+
endif()
454460
if (NOT IOS)
455461
find_package(${QT_VERSION_BASE} COMPONENTS PrintSupport REQUIRED)
456462
else()
457463
add_definitions(-DQT_NO_PRINTER)
458464
endif()
459-
find_package(${QT_VERSION_BASE} COMPONENTS Positioning)
460465
if (WITH_QTWEBKIT AND NOT WITH_QT6)
461466
find_package(Qt5WebKit REQUIRED)
462467
find_package(Qt5WebKitWidgets REQUIRED)
@@ -506,18 +511,14 @@ if(WITH_CORE)
506511
endif()
507512

508513
# Password helper
509-
if (WITH_QT6)
510-
# nope, not yet!
511-
else()
512-
find_package(QtKeychain REQUIRED)
513-
# Master password hash and authentication encryption
514-
find_package(QCA REQUIRED)
515-
# Check for runtime dependency of qca-ossl plugin
516-
# REQUIRED if unit tests are to be run from build directory
517-
if(NOT MSVC)
518-
include(QCAMacros)
519-
FIND_QCAOSSL_PLUGIN_CPP(ENABLE_TESTS)
520-
endif()
514+
find_package(QtKeychain REQUIRED)
515+
# Master password hash and authentication encryption
516+
find_package(QCA REQUIRED)
517+
# Check for runtime dependency of qca-ossl plugin
518+
# REQUIRED if unit tests are to be run from build directory
519+
if(NOT MSVC)
520+
include(QCAMacros)
521+
FIND_QCAOSSL_PLUGIN_CPP(ENABLE_TESTS)
521522
endif()
522523

523524
if (APPLE)

‎cmake/FindQCA.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if(QCA_INCLUDE_DIR AND QCA_LIBRARY)
2020

2121
else(QCA_INCLUDE_DIR AND QCA_LIBRARY)
2222

23-
set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5)
23+
set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5 qca-qt6)
2424

2525
find_library(QCA_LIBRARY
2626
NAMES ${QCA_LIBRARY_NAMES}
@@ -45,7 +45,7 @@ else(QCA_INCLUDE_DIR AND QCA_LIBRARY)
4545
"$ENV{LIB_DIR}/include"
4646
$ENV{INCLUDE}
4747
/usr/local/include
48-
PATH_SUFFIXES QtCrypto qt5/QtCrypto Qca-qt5/QtCrypto qt/Qca-qt5/QtCrypto qt5/Qca-qt5/QtCrypto
48+
PATH_SUFFIXES QtCrypto qt5/QtCrypto Qca-qt5/QtCrypto qt/Qca-qt5/QtCrypto qt5/Qca-qt5/QtCrypto Qca-qt6/QtCrypto
4949
)
5050

5151
if(QCA_LIBRARY AND QCA_INCLUDE_DIR)

‎cmake/FindQtKeychain.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ FIND_PATH(QTKEYCHAIN_INCLUDE_DIR keychain.h
2121
$ENV{INCLUDE}
2222
/usr/local/include
2323
/usr/include
24-
PATH_SUFFIXES qt5keychain qtkeychain
24+
PATH_SUFFIXES qt5keychain qtkeychain qt6keychain
2525
)
2626

27-
FIND_LIBRARY(QTKEYCHAIN_LIBRARY NAMES qt5keychain qtkeychain
27+
FIND_LIBRARY(QTKEYCHAIN_LIBRARY NAMES qt5keychain qtkeychain qt6keychain
2828
PATHS
2929
${LIB_DIR}
3030
"$ENV{LIB_DIR}"

‎src/core/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,10 @@ target_link_libraries(qgis_core
19251925
${ZLIB_LIBRARIES}
19261926
)
19271927

1928+
if (WITH_QT6)
1929+
target_link_libraries(qgis_core Qt6::Core5Compat)
1930+
endif()
1931+
19281932
if (WITH_EPT)
19291933
target_link_libraries(qgis_core
19301934
${ZSTD_LIBRARY}

0 commit comments

Comments
 (0)
Please sign in to comment.