KAuth: Make D-Bus dependency optional.

Review Request #129590 - Created Nov. 30, 2016 and updated

Information
Gleb Popov
kauth
Reviewers
kdeframeworks, kdewin

This adds an ENABLE_DBUS CMake option defaulting to ON, which can be used to make KAuth not depend on DBus. This is useful for some apps that are running on Windows.

https://www.mail-archive.com/kde-frameworks-devel@kde.org/msg34246.html


  

Issues

  • 1
  • 0
  • 0
  • 1
Description From Last Updated
Better split this into two, to avoid confusing people. David Faure David Faure
David Faure

Looks good, just one comment.

autotests/CMakeLists.txt (Diff revision 1)
 
 

Better split this into two, to avoid confusing people.

  1. I've update the patch, but do not have access rights to upload the path, so I appended it here:

    commit ec98addbfbba62310e050046078380c10192b829
    Author: Ralf Habacker ralf.habacker@freenet.de
    Date: Mon Jul 17 11:16:39 2017 +0200

    Make building with QtDBus optional
    
    This patch adds an ENABLE_DBUS CMake option defaulting to ON,
    which can be used to make KAuth not depend on DBus.
    This is useful for some apps that are running on Windows or Mac OSX.
    
    see https://www.mail-archive.com/kde-frameworks-devel@kde.org/msg34246.html
    

    diff --git a/CMakeLists.txt b/CMakeLists.txt
    index 13a6129..c53ff15 100644
    --- a/CMakeLists.txt
    +++ b/CMakeLists.txt
    @@ -11,8 +11,16 @@ feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKA

    set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})

    +option(ENABLE_DBUS "Enable D-Bus functionality" ON)
    +add_feature_info(D-Bus ENABLE_DBUS "Enable D-Bus functionality")
    +
    +if(ENABLE_DBUS)
    + set(DBUS_PACKAGE DBus)
    + set(DBUS_LIBRARY Qt::DBus)
    +endif()
    +
    set(REQUIRED_QT_VERSION 5.6.0)
    -find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets DBus)
    +find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Widgets ${DBUS_PACKAGE})
    include(KDEInstallDirs)
    include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
    include(KDECMakeSettings)
    diff --git a/autotests/CMakeLists.txt b/autotests/CMakeLists.txt
    index b53d760..fe07742 100644
    --- a/autotests/CMakeLists.txt
    +++ b/autotests/CMakeLists.txt
    @@ -5,6 +5,10 @@ if(NOT Qt5Test_FOUND)
    message(STATUS "Qt5Test not found, autotests will not be built.")
    return()
    endif()
    +if(NOT ENABLE_DBUS)
    + message(STATUS "Autotests will not be built, because DBus was disabled.")
    + return()
    +endif()

    qt5_add_dbus_adaptor(kauth_dbus_adaptor_tests_SRCS
    ../src/backends/dbus/org.kde.kf5auth.xml
    @@ -39,7 +43,7 @@ target_include_directories(kauth_tests_static
    ${CMAKE_CURRENT_SOURCE_DIR}/../src
    )

    -target_link_libraries(kauth_tests_static PUBLIC Qt5::DBus KF5::CoreAddons)
    +target_link_libraries(kauth_tests_static PUBLIC ${DBUS_LIBRARY} KF5::CoreAddons)

    ########### next target ###############

    diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
    index 662a0dd..5754ceb 100644
    --- a/src/CMakeLists.txt
    +++ b/src/CMakeLists.txt
    @@ -31,7 +31,7 @@ add_library(KF5::Auth ALIAS KF5Auth)
    target_include_directories(KF5Auth INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/KAuth>")

    target_link_libraries(KF5Auth PUBLIC Qt5::Core KF5::CoreAddons) # for KJob
    -target_link_libraries(KF5Auth PRIVATE Qt5::Widgets Qt5::DBus)
    +target_link_libraries(KF5Auth PRIVATE Qt5::Widgets ${DBUS_LIBRARY})
    set_target_properties(KF5Auth PROPERTIES VERSION ${KAUTH_VERSION_STRING}
    SOVERSION ${KAUTH_SOVERSION}
    EXPORT_NAME Auth

Loading...