cmake: Add WITH_DBUS option

This commit is contained in:
Hennadii Stepanov 2024-07-24 13:19:00 +01:00
parent 5bb5a4bc75
commit 10fcc668a3
No known key found for this signature in database
GPG key ID: 410108112E7EA81F
3 changed files with 13 additions and 0 deletions

View file

@ -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}")

View file

@ -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

View file

@ -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.