Skip to content

Commit

Permalink
Find QtKeychain by its cmake target
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn authored and nyalldawson committed Feb 10, 2024
1 parent 3a18496 commit b9e859f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 65 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,11 @@ if(WITH_CORE)
endif()

# Password helper
find_package(QtKeychain REQUIRED)
if(BUILD_WITH_QT6)
find_package(Qt6Keychain CONFIG REQUIRED)
else()
find_package(Qt5Keychain CONFIG REQUIRED)
endif()
# Master password hash and authentication encryption
find_package(QCA REQUIRED)
# Check for runtime dependency of qca-ossl plugin
Expand Down
52 changes: 0 additions & 52 deletions cmake/FindQtKeychain.cmake

This file was deleted.

8 changes: 6 additions & 2 deletions external/o2/src/o0keychainstore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
#include "o0keychainstore.h"

#include <QDebug>
#include <keychain.h>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <qt6keychain/keychain.h>
#else
#include <qt5keychain/keychain.h>
#endif
#include <QtCore/QDataStream>
#include <QtCore/QBuffer>
#include <QtCore/QEventLoop>
Expand Down Expand Up @@ -75,4 +79,4 @@ void o0keyChainStore::clearFromKeychain() {
if ( job.error() ) {
qWarning() << "Deleting keychain failed: " << qPrintable(job.errorString());
}
}
}
3 changes: 0 additions & 3 deletions src/auth/oauth2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
########################################################
# Packages

if(NOT QTKEYCHAIN_FOUND)
find_package(QtKeychain REQUIRED)
endif()
option(WITH_INTERNAL_O2 "Download and locally include source of o2 library" ON)

if(WITH_INTERNAL_O2)
Expand Down
12 changes: 10 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2249,7 +2249,6 @@ target_include_directories(qgis_core SYSTEM PUBLIC
${SPATIALINDEX_INCLUDE_DIR} # before GEOS for case-insensitive filesystems
${SQLITE3_INCLUDE_DIR}
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
${${QT_VERSION_BASE}SerialPort_INCLUDE_DIRS}
${Protobuf_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
Expand Down Expand Up @@ -2411,7 +2410,6 @@ target_link_libraries(qgis_core
${QT_VERSION_BASE}::Concurrent
${OPTIONAL_QTWEBKIT}
${QCA_LIBRARY}
${QTKEYCHAIN_LIBRARY}
GEOS::geos_c
GDAL::GDAL
${SPATIALINDEX_LIBRARY}
Expand All @@ -2424,6 +2422,16 @@ target_link_libraries(qgis_core
PROJ::proj
)

if(BUILD_WITH_QT6)
target_link_libraries(qgis_core
Qt6Keychain::Qt6Keychain
)
else()
target_link_libraries(qgis_core
Qt5Keychain::Qt5Keychain
)
endif()

if (WITH_QTPRINTER)
target_link_libraries(qgis_core ${QT_VERSION_BASE}::PrintSupport)
target_include_directories(qgis_core SYSTEM PUBLIC ${${QT_VERSION_BASE}PrintSupport_INCLUDE_DIRS})
Expand Down
3 changes: 0 additions & 3 deletions src/core/auth/qgsauthmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
#include <QSslConfiguration>
#endif

// QtKeyChain library
#include "keychain.h"

// QGIS includes
#include "qgsauthcertutils.h"
#include "qgsauthcrypto.h"
Expand Down
7 changes: 5 additions & 2 deletions src/core/auth/qgsauthmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@
#include "qgsauthconfig.h"
#include "qgsauthmethod.h"

// Qt5KeyChain library
#include "keychain.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#include <qt6keychain/keychain.h>
#else
#include <qt5keychain/keychain.h>
#endif

#ifndef SIP_RUN
namespace QCA
Expand Down

0 comments on commit b9e859f

Please sign in to comment.