diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,12 +41,17 @@ # Dependencies set(REQUIRED_QT_VERSION 5.10.0) -find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus Xml) +find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Xml) +if (NOT ANDROID) + find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED DBus) +endif() find_package(KF5Config ${KF5_DEP_VERSION} REQUIRED) find_package(KF5CoreAddons ${KF5_DEP_VERSION} REQUIRED) find_package(KF5Crash ${KF5_DEP_VERSION} REQUIRED) -find_package(KF5DBusAddons ${KF5_DEP_VERSION} REQUIRED) +if (NOT ANDROID) + find_package(KF5DBusAddons ${KF5_DEP_VERSION} REQUIRED) +endif() find_package(KF5I18n ${KF5_DEP_VERSION} REQUIRED) find_package(KF5DocTools ${KF5_DEP_VERSION}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -37,8 +37,10 @@ sycoca/kmimeassociations.cpp sycoca/vfolder_menu.cpp plugin/kplugintrader.cpp - plugin/kdbusservicestarter.cpp ) +if (TARGET Qt5::DBus) + list(APPEND kservice_SRCS plugin/kdbusservicestarter.cpp) +endif() ecm_qt_declare_logging_category(kservice_SRCS HEADER servicesdebug.h IDENTIFIER SERVICES CATEGORY_NAME kf5.kservice.services) ecm_qt_declare_logging_category(kservice_SRCS HEADER sycocadebug.h IDENTIFIER SYCOCA CATEGORY_NAME kf5.kservice.sycoca) @@ -70,7 +72,9 @@ # kservice cannot depend on kinit (because kinit->kio->kservice), so we need a copy of org.kde.KLauncher.xml here. # And I don't want to have it here as a source file (who wants to edit dbus xml by hand), so it can be # generated from klauncher's implementation header. -qt5_add_dbus_interface(kservice_SRCS kdeinit/org.kde.KLauncher.xml klauncher_iface) +if (TARGET Qt5::DBus) + qt5_add_dbus_interface(kservice_SRCS kdeinit/org.kde.KLauncher.xml klauncher_iface) +endif() add_library(KF5Service ${kservice_SRCS}) if(WIN32) @@ -96,9 +100,11 @@ KF5::CoreAddons # KShell KPluginLoader PRIVATE KF5::I18n - KF5::DBusAddons # KDEInitInterface Qt5::Xml # (for vfolder menu) QDomDocument ) +if (TARGET KF5::DBusAddons) + target_link_libraries(KF5Service PRIVATE KF5::DBusAddons) # KDEInitInterface +endif() set_target_properties(KF5Service PROPERTIES VERSION ${KSERVICE_VERSION_STRING} SOVERSION ${KSERVICE_SOVERSION} diff --git a/src/kdeinit/ktoolinvocation.cpp b/src/kdeinit/ktoolinvocation.cpp --- a/src/kdeinit/ktoolinvocation.cpp +++ b/src/kdeinit/ktoolinvocation.cpp @@ -19,11 +19,15 @@ */ #include "ktoolinvocation.h" +#ifdef QT_DBUS_LIB #include "klauncher_iface.h" -#include #include +#endif +#include +#include #include +#include #include #include #include @@ -76,6 +80,7 @@ const QByteArray &startup_id, bool noWait, const QString &workdir) { +#ifdef QT_DBUS_LIB QString function = QLatin1String(_function); KToolInvocation::ensureKdeinitRunning(); QDBusMessage msg = QDBusMessage::createMethodCall(QStringLiteral("org.kde.klauncher5"), @@ -124,6 +129,9 @@ *pid = reply.arguments().at(3).toInt(); } return reply.arguments().at(0).toInt(); +#else + return ENOTSUP; +#endif } #ifndef KSERVICE_NO_DEPRECATED @@ -294,6 +302,8 @@ void KToolInvocation::ensureKdeinitRunning() { +#ifdef QT_DBUS_LIB KDEInitInterface::ensureKdeinitRunning(); +#endif }