Get rid of FindQt5Keychain.cmake

QtKeychain provides Qt5KeychainConfig.cmake and friends nowadays, so no
need to have a less reliable and outdated find module on our end.

Also this shows that we were including keychain.h in the wrong way and
were not using the link target, so both got fixed as well.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-10-29 13:24:20 +01:00
parent dfd6cce978
commit 3427dadaeb
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
9 changed files with 9 additions and 61 deletions

View file

@ -1,50 +0,0 @@
# (c) 2014 Copyright ownCloud GmbH
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING* file.
# - Try to find QtKeychain
# Once done this will define
# QTKEYCHAIN_FOUND - System has QtKeychain
# QTKEYCHAIN_INCLUDE_DIRS - The QtKeychain include directories
# QTKEYCHAIN_LIBRARIES - The libraries needed to use QtKeychain
# QTKEYCHAIN_DEFINITIONS - Compiler switches required for using LibXml2
# When we build our own Qt we also need to build QtKeychain with it
# so that it doesn't pull a different Qt version. For that reason
# first look in the Qt lib directory for QtKeychain.
get_target_property(_QTCORE_LIB_PATH Qt5::Core IMPORTED_LOCATION_RELEASE)
# Use PATH here because Debian 7.0 has CMake 2.8.9 and DIRECTORY is only available from 2.8.12+
get_filename_component(QT_LIB_DIR "${_QTCORE_LIB_PATH}" PATH)
find_path(QTKEYCHAIN_INCLUDE_DIR
NAMES
keychain.h
HINTS
${QT_LIB_DIR}/../include
PATH_SUFFIXES
qt5keychain
)
find_library(QTKEYCHAIN_LIBRARY
NAMES
qt5keychain
lib5qtkeychain
HINTS
${QT_LIB_DIR}
PATHS
/usr/lib
/usr/lib/${CMAKE_ARCH_TRIPLET}
/usr/local/lib
/opt/local/lib
${CMAKE_LIBRARY_PATH}
${CMAKE_INSTALL_PREFIX}/lib
)
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set QTKEYCHAIN_FOUND to TRUE
# if all listed variables are TRUE
find_package_handle_standard_args(Qt5Keychain DEFAULT_MSG
QTKEYCHAIN_LIBRARY QTKEYCHAIN_INCLUDE_DIR)
mark_as_advanced(QTKEYCHAIN_INCLUDE_DIR QTKEYCHAIN_LIBRARY)

View file

@ -227,9 +227,8 @@ set( final_src
${3rdparty_MOC}
)
if(QTKEYCHAIN_FOUND OR QT5KEYCHAIN_FOUND)
list(APPEND libsync_LINK_TARGETS ${QTKEYCHAIN_LIBRARY})
include_directories(${QTKEYCHAIN_INCLUDE_DIR})
if(Qt5Keychain_FOUND)
list(APPEND libsync_LINK_TARGETS qt5keychain)
endif()
# add executable icon on windows and osx

View file

@ -33,7 +33,7 @@
#include "owncloudgui.h"
#include "syncengine.h"
#include <keychain.h>
#include <qt5keychain/keychain.h>
using namespace QKeychain;

View file

@ -21,7 +21,7 @@
#include <QApplication>
#include <keychain.h>
#include <qt5keychain/keychain.h>
using namespace OCC;
using namespace QKeychain;

View file

@ -106,8 +106,7 @@ target_link_libraries(${synclib_NAME}
if (NOT TOKEN_AUTH_ONLY)
find_package(Qt5 REQUIRED COMPONENTS Widgets Svg)
target_link_libraries(${synclib_NAME} Qt5::Widgets Qt5::Svg ${QTKEYCHAIN_LIBRARY})
target_include_directories(${synclib_NAME} PRIVATE ${QTKEYCHAIN_INCLUDE_DIR})
target_link_libraries(${synclib_NAME} Qt5::Widgets Qt5::Svg qt5keychain)
endif()
if(INOTIFY_FOUND)

View file

@ -40,7 +40,7 @@
#include <QJsonObject>
#include <QJsonArray>
#include <keychain.h>
#include <qt5keychain/keychain.h>
#include "creds/abstractcredentials.h"
using namespace QKeychain;

View file

@ -33,7 +33,7 @@
#include <QUuid>
#include <QScopeGuard>
#include <keychain.h>
#include <qt5keychain/keychain.h>
#include "common/utility.h"
#include "wordlist.h"

View file

@ -22,7 +22,7 @@
#include <QJsonDocument>
#include <QBuffer>
#include <keychain.h>
#include <qt5keychain/keychain.h>
#include "account.h"
#include "accessmanager.h"

View file

@ -17,7 +17,7 @@
#define KEYCHAINCHUNK_H
#include <QObject>
#include <keychain.h>
#include <qt5keychain/keychain.h>
#include "accountfwd.h"
// We don't support insecure fallback