Fallback to pkg-config for dbus (#689)

This commit is contained in:
ilya-fedin 2022-04-26 04:32:01 +04:00 committed by GitHub
parent c1c63a27de
commit 2ea5bb9168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -679,12 +679,21 @@ set(CORE_OBJS
set(HAVE_RTKIT 0)
option(ALSOFT_REQUIRE_RTKIT "Require RTKit/D-Bus support" FALSE)
find_package(DBus1 QUIET)
if(DBus1_FOUND)
if(NOT DBus1_FOUND AND PkgConfig_FOUND)
pkg_check_modules(DBUS dbus-1)
endif()
if(DBus1_FOUND OR DBUS_FOUND)
option(ALSOFT_RTKIT "Enable RTKit support" ON)
if(ALSOFT_RTKIT)
set(HAVE_RTKIT 1)
set(CORE_OBJS ${CORE_OBJS} core/dbus_wrap.cpp core/dbus_wrap.h core/rtkit.cpp core/rtkit.h)
if(WIN32 OR HAVE_DLFCN_H)
if(NOT DBus1_FOUND)
set(INC_PATHS ${INC_PATHS} ${DBUS_INCLUDE_DIRS})
set(CPP_DEFS ${CPP_DEFS} ${DBUS_CFLAGS_OTHER})
if(NOT WIN32 AND NOT HAVE_DLFCN_H)
set(EXTRA_LIBS ${EXTRA_LIBS} ${DBUS_LINK_LIBRARIES})
endif()
elseif(WIN32 OR HAVE_DLFCN_H)
set(INC_PATHS ${INC_PATHS} ${DBus1_INCLUDE_DIRS})
set(CPP_DEFS ${CPP_DEFS} ${DBus1_DEFINITIONS})
else()