1
0
mirror of https://github.com/chylex/Nextcloud-Desktop.git synced 2025-04-24 16:15:47 +02:00

Add PLUGINDIR cmake setting and define

By default, plugins are only searched next to the binary or next to the
other Qt plugins. This optional build variable allows another path to be
configured.

The idea is that on linux the oC packaging probably wants the binary in
something like /opt/owncloud/bin and the plugins in
/opt/owncloud/lib/plugins.

Similarly, distribution packagers probably don't want the plugins next
to the binary or next to the other Qt plugins. This flag allows them to
configure another path that the executable will look in.
This commit is contained in:
Christian Kamm 2019-03-07 10:58:40 +01:00 committed by Kevin Ottens
parent 87bd26bf6c
commit cc840534c0
No known key found for this signature in database
GPG Key ID: 074BBBCB8DECC9E2
4 changed files with 15 additions and 2 deletions

View File

@ -105,6 +105,7 @@ if(WIN32)
set(DATADIR "share")
endif(WIN32)
set(SHAREDIR ${DATADIR})
set(PLUGINDIR "${CMAKE_INSTALL_FULL_LIBDIR}/${APPLICATION_SHORTNAME}/plugins" CACHE STRING "Extra path to look for Qt plugins like for VFS. May be relative to binary.")
#####
## handle BUILD_OWNCLOUD_OSX_BUNDLE

View File

@ -33,5 +33,6 @@
#cmakedefine SYSCONFDIR "@SYSCONFDIR@"
#cmakedefine SHAREDIR "@SHAREDIR@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"
#endif

View File

@ -269,6 +269,17 @@ Application::Application(int &argc, char **argv)
if (!AbstractNetworkJob::httpTimeout)
AbstractNetworkJob::httpTimeout = cfg.timeout();
#ifdef PLUGINDIR
// Setup extra plugin search path
QString extraPluginPath = QStringLiteral(PLUGINDIR);
if (!extraPluginPath.isEmpty()) {
if (QDir::isRelativePath(extraPluginPath))
extraPluginPath = QDir(QApplication::applicationDirPath()).filePath(extraPluginPath);
qCInfo(lcApplication) << "Adding extra plugin search path:" << extraPluginPath;
addLibraryPath(extraPluginPath);
}
#endif
// Check vfs plugins
if (Theme::instance()->showVirtualFilesOption() && bestAvailableVfsMode() == Vfs::Off) {
qCWarning(lcApplication) << "Theme wants to show vfs mode, but no vfs plugins are available";

View File

@ -14,7 +14,7 @@ set_target_properties("${synclib_NAME}_vfs_suffix" PROPERTIES
)
INSTALL(TARGETS "${synclib_NAME}_vfs_suffix"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/plugins"
RUNTIME DESTINATION "${CMAKE_INSTALL_LIBDIR}/plugins"
LIBRARY DESTINATION "${PLUGINDIR}"
RUNTIME DESTINATION "${PLUGINDIR}"
)