Skip to content

Commit

Permalink
[qt6] CMake build adjustments for qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and m-kuhn committed Mar 25, 2021
1 parent 8e8febb commit 7a56c36
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
27 changes: 14 additions & 13 deletions CMakeLists.txt
Expand Up @@ -451,12 +451,17 @@ if(WITH_CORE)
endif()

find_package(${QT_VERSION_BASE} COMPONENTS Core Gui Widgets Network Xml Svg Concurrent Test UiTools Sql REQUIRED)
if (WITH_QT6)
find_package(${QT_VERSION_BASE} COMPONENTS Core5Compat REQUIRED)
else()
# TODO only available starting from Qt 6.2
find_package(${QT_VERSION_BASE} COMPONENTS Positioning)
endif()
if (NOT IOS)
find_package(${QT_VERSION_BASE} COMPONENTS PrintSupport REQUIRED)
else()
add_definitions(-DQT_NO_PRINTER)
endif()
find_package(${QT_VERSION_BASE} COMPONENTS Positioning)
if (WITH_QTWEBKIT AND NOT WITH_QT6)
find_package(Qt5WebKit REQUIRED)
find_package(Qt5WebKitWidgets REQUIRED)
Expand Down Expand Up @@ -506,18 +511,14 @@ if(WITH_CORE)
endif()

# Password helper
if (WITH_QT6)
# nope, not yet!
else()
find_package(QtKeychain REQUIRED)
# Master password hash and authentication encryption
find_package(QCA REQUIRED)
# Check for runtime dependency of qca-ossl plugin
# REQUIRED if unit tests are to be run from build directory
if(NOT MSVC)
include(QCAMacros)
FIND_QCAOSSL_PLUGIN_CPP(ENABLE_TESTS)
endif()
find_package(QtKeychain REQUIRED)
# Master password hash and authentication encryption
find_package(QCA REQUIRED)
# Check for runtime dependency of qca-ossl plugin
# REQUIRED if unit tests are to be run from build directory
if(NOT MSVC)
include(QCAMacros)
FIND_QCAOSSL_PLUGIN_CPP(ENABLE_TESTS)
endif()

if (APPLE)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindQCA.cmake
Expand Up @@ -20,7 +20,7 @@ if(QCA_INCLUDE_DIR AND QCA_LIBRARY)

else(QCA_INCLUDE_DIR AND QCA_LIBRARY)

set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5)
set(QCA_LIBRARY_NAMES qca-qt5 qca2-qt5 qca-qt6)

find_library(QCA_LIBRARY
NAMES ${QCA_LIBRARY_NAMES}
Expand All @@ -45,7 +45,7 @@ else(QCA_INCLUDE_DIR AND QCA_LIBRARY)
"$ENV{LIB_DIR}/include"
$ENV{INCLUDE}
/usr/local/include
PATH_SUFFIXES QtCrypto qt5/QtCrypto Qca-qt5/QtCrypto qt/Qca-qt5/QtCrypto qt5/Qca-qt5/QtCrypto
PATH_SUFFIXES QtCrypto qt5/QtCrypto Qca-qt5/QtCrypto qt/Qca-qt5/QtCrypto qt5/Qca-qt5/QtCrypto Qca-qt6/QtCrypto
)

if(QCA_LIBRARY AND QCA_INCLUDE_DIR)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindQtKeychain.cmake
Expand Up @@ -21,10 +21,10 @@ FIND_PATH(QTKEYCHAIN_INCLUDE_DIR keychain.h
$ENV{INCLUDE}
/usr/local/include
/usr/include
PATH_SUFFIXES qt5keychain qtkeychain
PATH_SUFFIXES qt5keychain qtkeychain qt6keychain
)

FIND_LIBRARY(QTKEYCHAIN_LIBRARY NAMES qt5keychain qtkeychain
FIND_LIBRARY(QTKEYCHAIN_LIBRARY NAMES qt5keychain qtkeychain qt6keychain
PATHS
${LIB_DIR}
"$ENV{LIB_DIR}"
Expand Down
4 changes: 4 additions & 0 deletions src/core/CMakeLists.txt
Expand Up @@ -1925,6 +1925,10 @@ target_link_libraries(qgis_core
${ZLIB_LIBRARIES}
)

if (WITH_QT6)
target_link_libraries(qgis_core Qt6::Core5Compat)
endif()

if (WITH_EPT)
target_link_libraries(qgis_core
${ZSTD_LIBRARY}
Expand Down

0 comments on commit 7a56c36

Please sign in to comment.