Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2020-04-20 16:28:20 +0300
committerHannah von Reth <vonreth@kde.org>2020-04-23 19:55:04 +0300
commit5cce3eaf9157a51e5c76adec1b4cb9599f57e503 (patch)
tree143f2fc4cd30f16f0831a2e6565fe6467ae1886f /cmake
parent66d6375c3d81383c74be5b0fee22a2c7f5022f1e (diff)
Plugins: Add a relative plugin search path on Linux
This fixes installations where the client is not installed in the same prefix as Qt Fixes: #7801
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/OCConfigPluginDir.cmake35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake/modules/OCConfigPluginDir.cmake b/cmake/modules/OCConfigPluginDir.cmake
new file mode 100644
index 000000000..af6421833
--- /dev/null
+++ b/cmake/modules/OCConfigPluginDir.cmake
@@ -0,0 +1,35 @@
+function(IS_SUBDIR ROOT CHILD OUT)
+ file(RELATIVE_PATH REL_PATH "${ROOT}" "${CHILD}")
+ string(REGEX MATCH "^\.\./" NOT_SUBDIR "${REL_PATH}")
+ if (NOT_SUBDIR)
+ set(${OUT} FALSE PARENT_SCOPE)
+ else()
+ set(${OUT} TRUE PARENT_SCOPE)
+ endif()
+endfunction()
+
+
+if (UNIX AND NOT APPLE)
+ set(OC_PLUGIN_DIR ${KDE_INSTALL_FULL_PLUGINDIR})
+ IS_SUBDIR("${CMAKE_INSTALL_PREFIX}" "${OC_PLUGIN_DIR}" _is_subdir)
+ if (NOT _is_subdir)
+ if (KDE_INSTALL_USE_QT_SYS_PATHS)
+ message(FATAL_ERROR "Using KDE_INSTALL_USE_QT_SYS_PATHS with a non bundled Qt is not supported.")
+ else()
+ message(FATAL_ERROR "KDE_INSTALL_PLUGINDIR must be located in CMAKE_INSTALL_PREFIX")
+ endif()
+ endif()
+
+ include(ECMQueryQmake)
+ query_qmake(_qt_plugin_dir QT_INSTALL_PLUGINS TRY)
+ # any sub dir of _qt_plugin_dir is sufficient
+ IS_SUBDIR("${_qt_plugin_dir}" "${OC_PLUGIN_DIR}" _is_subdir)
+ if (_is_subdir)
+ # no need to add a additional plugin dir
+ unset(OC_PLUGIN_DIR)
+ else()
+ # set plugin dir to a path relative to the binary
+ file(RELATIVE_PATH OC_PLUGIN_DIR "${CMAKE_INSTALL_FULL_BINDIR}" "${OC_PLUGIN_DIR}")
+ message(STATUS "Adding additional plugin path: ${OC_PLUGIN_DIR}")
+ endif()
+endif()