diff --git a/CMakeLists.txt b/CMakeLists.txt index 499cee345a1..9320be019b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -151,11 +151,16 @@ if(WITH_QRENCODE) set(USE_QRCODE TRUE) endif() +cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND BUILD_GUI" OFF) if(BUILD_GUI) set(qt_components Core Gui Widgets LinguistTools) if(ENABLE_WALLET) list(APPEND qt_components Network) endif() + if(WITH_DBUS) + list(APPEND qt_components DBus) + set(USE_DBUS TRUE) + endif() find_package(Qt5 5.11.3 MODULE REQUIRED COMPONENTS ${qt_components} ) @@ -498,6 +503,7 @@ message(" - using UPnP ....................... ${WITH_MINIUPNPC}") message(" ZeroMQ .............................. ${WITH_ZMQ}") message(" USDT tracing ........................ ${WITH_USDT}") message(" QR code (GUI) ....................... ${WITH_QRENCODE}") +message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}") message("Tests:") message(" test_bitcoin ........................ ${BUILD_TESTS}") message(" bench_bitcoin ....................... ${BUILD_BENCH}") diff --git a/cmake/bitcoin-config.h.in b/cmake/bitcoin-config.h.in index dc030a24e61..094eb8040a3 100644 --- a/cmake/bitcoin-config.h.in +++ b/cmake/bitcoin-config.h.in @@ -141,6 +141,9 @@ /* Define if BDB support should be compiled in */ #cmakedefine USE_BDB 1 +/* Define if dbus support should be compiled in */ +#cmakedefine USE_DBUS 1 + /* Define if QR support should be compiled in */ #cmakedefine USE_QRCODE 1 diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index c4c4f980b87..b7161127976 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -214,6 +214,10 @@ if(ENABLE_WALLET) ) endif() +if(WITH_DBUS) + target_link_libraries(bitcoinqt PRIVATE Qt5::DBus) +endif() + if(qt_lib_type STREQUAL "STATIC_LIBRARY") # We want to define static plugins to link ourselves, thus preventing # automatic linking against a "sane" set of default static plugins.