From 2c0a379f3acfcc5dad70683c81d22d2a13f148e0 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 2 May 2019 15:26:02 +0200 Subject: Minimal libcloudproviders support #7209 - Add it as an optional dependency for linux builds, controlled by WITH_LIBCLOUDPROVIDERS, which is enabled automatically if the dependencies are available. Note that >=0.3.0 is required. - Add code to export sync folders through the library and to add a minimal "Settings..." menu action. - Set up cloud provider registration by installing a file into a path like /usr/share/cloud-providers/. - DBus name and path are derived from APPLICATION_REV_DOMAIN by default and may be overridden with APPLICATION_CLOUDPROVIDERS_DBUS_NAME and APPLICATION_CLOUDPROVIDERS_DBUS_PATH if necessary. --- cmake/modules/FindLibcloudproviders.cmake | 42 +++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 cmake/modules/FindLibcloudproviders.cmake (limited to 'cmake') diff --git a/cmake/modules/FindLibcloudproviders.cmake b/cmake/modules/FindLibcloudproviders.cmake new file mode 100644 index 000000000..39edb200c --- /dev/null +++ b/cmake/modules/FindLibcloudproviders.cmake @@ -0,0 +1,42 @@ +# (c) 2019 Copyright ownCloud GmbH +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING* file. + +find_path(LIBCLOUDPROVIDERS_INCLUDE_DIR + NAMES + cloudprovidersaccountexporter.h + cloudprovidersproviderexporter.h + PATH_SUFFIXES + cloudproviders + ) + +find_library(LIBCLOUDPROVIDERS_LIBRARY + NAMES + cloudproviders + PATHS + /usr/lib + /usr/lib/${CMAKE_ARCH_TRIPLET} + /usr/local/lib + ${CMAKE_LIBRARY_PATH} + ${CMAKE_INSTALL_PREFIX}/lib + ) + +# Using version <0.3.0 would lead to crashes during runtime when accounts are unexported. +get_filename_component(LIBCLOUDPROVIDERS_LIBRARY_REALPATH ${LIBCLOUDPROVIDERS_LIBRARY} REALPATH) +if(${LIBCLOUDPROVIDERS_LIBRARY_REALPATH} MATCHES "\.([0-9]*)\.([0-9]*)\.([0-9]*)$") + if ((${CMAKE_MATCH_1} EQUAL 0) AND (${CMAKE_MATCH_2} LESS 3)) + message("libcloudproviders version is older than 0.3.0, not enabling it") + set(LIBCLOUDPROVIDERS_LIBRARY "") + endif() +else() + message("Can't determine libcloudproviders version, not enabling it") + set(LIBCLOUDPROVIDERS_LIBRARY "") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + LIBCLOUDPROVIDERS + DEFAULT_MSG + LIBCLOUDPROVIDERS_LIBRARY LIBCLOUDPROVIDERS_INCLUDE_DIR) + +mark_as_advanced(LIBCLOUDPROVIDERS_INCLUDE_DIR LIBCLOUDPROVIDERS_LIBRARY) -- cgit v1.2.3