Get rid of FindQt5Keychain.cmake
authorKevin Ottens <kevin.ottens@nextcloud.com>
Thu, 29 Oct 2020 12:24:20 +0000 (13:24 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Mon, 2 Nov 2020 12:19:48 +0000 (13:19 +0100)
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>
cmake/modules/FindQt5Keychain.cmake [deleted file]
src/gui/CMakeLists.txt
src/gui/creds/shibbolethcredentials.cpp
src/gui/proxyauthhandler.cpp
src/libsync/CMakeLists.txt
src/libsync/account.cpp
src/libsync/clientsideencryption.cpp
src/libsync/creds/httpcredentials.cpp
src/libsync/creds/keychainchunk.h

diff --git a/cmake/modules/FindQt5Keychain.cmake b/cmake/modules/FindQt5Keychain.cmake
deleted file mode 100644 (file)
index 4aff32d..0000000
+++ /dev/null
@@ -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)
index 000d00752f696ebbe7c2ff85571dde1f793f09aa..2ff8c17ac951105fa7b9e9593b3a591e78a11d07 100644 (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
index b19133785536d4efec959fda01e895def8c761ef..e56ed8be4b8218d05d22b778466c836bd7b4a9d8 100644 (file)
@@ -33,7 +33,7 @@
 #include "owncloudgui.h"
 #include "syncengine.h"
 
-#include <keychain.h>
+#include <qt5keychain/keychain.h>
 
 using namespace QKeychain;
 
index 9c2703bda303481851db46e951ef03de1499fc5a..a2f11bce255a5804fc63fcef19cf8bd8139671df 100644 (file)
@@ -21,7 +21,7 @@
 
 #include <QApplication>
 
-#include <keychain.h>
+#include <qt5keychain/keychain.h>
 
 using namespace OCC;
 using namespace QKeychain;
index aef76d246b2cd14f7e696ec9607883cdea5931ac..d7957dab88c893e8dada825b88f41356a4919cd4 100644 (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)
index 5477edcd962496333aaea31895a4938f00eececf..b6709e7fa26ff679c62a56a921dc5a247990e187 100644 (file)
@@ -40,7 +40,7 @@
 #include <QJsonObject>
 #include <QJsonArray>
 
-#include <keychain.h>
+#include <qt5keychain/keychain.h>
 #include "creds/abstractcredentials.h"
 
 using namespace QKeychain;
index 134a834256ccdb17d7ffa59ebcb63967f0412569..dcd512d1bd7783f3591e0073eed2d04a69e4ba1e 100644 (file)
@@ -33,7 +33,7 @@
 #include <QUuid>
 #include <QScopeGuard>
 
-#include <keychain.h>
+#include <qt5keychain/keychain.h>
 #include "common/utility.h"
 
 #include "wordlist.h"
index 9b1d10a9e3fb68600c7fe2ff82170d471492aa2c..551d2f3cd767123ac2ec8e6c0b8aefd163cc404c 100644 (file)
@@ -22,7 +22,7 @@
 #include <QJsonDocument>
 #include <QBuffer>
 
-#include <keychain.h>
+#include <qt5keychain/keychain.h>
 
 #include "account.h"
 #include "accessmanager.h"
index 4c31eca16f62bba4f9a0feec89c7b91024e0e7a9..0a08b8f2f54e895482bb0a7a77fe0c59da343cec 100644 (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