a82a13b70c
Thankfully StackOverflow had an evil solution to this missing feature in 3.10.
35 lines
1 KiB
CMake
35 lines
1 KiB
CMake
# Finding dbus (https://www.freedesktop.org/wiki/Software/dbus/)
|
|
# Defining:
|
|
# DBUS_LIBRARY
|
|
# DBUS_INCLUDE_DIR
|
|
|
|
if(WIN32)
|
|
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})
|
|
|
|
# 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}"
|
|
IMPORTED_LOCATION "${DBUS_LIBRARIES}"
|
|
)
|
|
endif()
|
|
else()
|
|
find_package(PkgConfig QUIET)
|
|
|
|
|
|
if(PKG_CONFIG_FOUND)
|
|
pkg_check_modules(DBUS IMPORTED_TARGET dbus-1)
|
|
endif (PKG_CONFIG_FOUND)
|
|
|
|
if(DBUS_FOUND)
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.11.0")
|
|
set_target_properties(PkgConfig::DBUS PROPERTIES IMPORTED_GLOBAL TRUE)
|
|
endif()
|
|
|
|
set(HAVE_DBUS 1)
|
|
# alias the PkgConfig name to standard one
|
|
add_library(DBus ALIAS PkgConfig::DBUS)
|
|
endif(DBUS_FOUND)
|
|
endif(WIN32)
|