2019-05-17 08:19:35 +00:00
|
|
|
# Finding dbus (https://www.freedesktop.org/wiki/Software/dbus/)
|
|
|
|
# Defining:
|
|
|
|
# DBUS_LIBRARY
|
|
|
|
# DBUS_INCLUDE_DIR
|
2019-05-27 10:37:35 +00:00
|
|
|
|
2020-08-27 21:33:08 +00:00
|
|
|
set(dbus_target "_no_target_")
|
|
|
|
|
2019-05-17 08:19:35 +00:00
|
|
|
if(WIN32)
|
2019-05-27 10:37:35 +00:00
|
|
|
FIND_PATH(DBUS_INCLUDE_DIRS dbus/dbus.h PATH_SUFFIXES include HINTS ${ADDITIONAL_LIBRARY_PATHS})
|
|
|
|
FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 PATH_SUFFIXES lib HINTS ${ADDITIONAL_LIBRARY_PATHS})
|
2019-03-04 21:18:15 +00:00
|
|
|
|
2019-05-27 10:37:35 +00:00
|
|
|
# define an imported target for DBus manually
|
|
|
|
if (DBUS_INCLUDE_DIRS AND DBUS_LIBRARIES)
|
|
|
|
add_library(DBus UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(DBus PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${DBUS_INCLUDE_DIRS}"
|
2019-05-27 16:47:24 +00:00
|
|
|
IMPORTED_LOCATION "${DBUS_LIBRARIES}"
|
2019-05-27 10:37:35 +00:00
|
|
|
)
|
2020-08-27 21:33:08 +00:00
|
|
|
|
|
|
|
set(HAVE_DBUS 1)
|
|
|
|
set(dbus_target "DBus")
|
2019-05-27 10:37:35 +00:00
|
|
|
endif()
|
2019-05-17 08:19:35 +00:00
|
|
|
else()
|
2020-06-15 20:03:08 +00:00
|
|
|
find_package(PkgConfig QUIET)
|
2019-05-27 10:37:35 +00:00
|
|
|
|
|
|
|
if(PKG_CONFIG_FOUND)
|
2020-08-19 13:49:50 +00:00
|
|
|
pkg_check_modules(DBUS IMPORTED_TARGET dbus-1)
|
2019-05-27 10:37:35 +00:00
|
|
|
endif (PKG_CONFIG_FOUND)
|
|
|
|
|
|
|
|
if(DBUS_FOUND)
|
|
|
|
set(HAVE_DBUS 1)
|
2020-08-27 21:33:08 +00:00
|
|
|
|
|
|
|
# can't use an ALIAS here, needs CMake 3.11
|
|
|
|
# use a global property instead
|
|
|
|
set(dbus_target "PkgConfig::DBUS")
|
2019-05-27 10:37:35 +00:00
|
|
|
endif(DBUS_FOUND)
|
2019-05-17 08:19:35 +00:00
|
|
|
endif(WIN32)
|