File: FindDBus.cmake

package info (click to toggle)
kodi 2%3A21.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 143,076 kB
  • sloc: cpp: 694,471; xml: 52,618; ansic: 38,300; python: 7,161; sh: 4,289; javascript: 2,325; makefile: 1,791; perl: 969; java: 513; cs: 390; objc: 340
file content (43 lines) | stat: -rw-r--r-- 1,580 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#.rst:
# FindDBUS
# -------
# Finds the DBUS library
#
# This will define the following target:
#
#   DBus::DBus   - The DBUS library

if(NOT TARGET DBus::DBus)
  find_package(PkgConfig)
  if(PKG_CONFIG_FOUND)
    pkg_check_modules(PC_DBUS dbus-1 QUIET)
  endif()

  find_path(DBUS_INCLUDE_DIR NAMES dbus/dbus.h
                             PATH_SUFFIXES dbus-1.0
                             HINTS ${PC_DBUS_INCLUDE_DIR})
  find_path(DBUS_ARCH_INCLUDE_DIR NAMES dbus/dbus-arch-deps.h
                                  PATH_SUFFIXES dbus-1.0/include
                                  HINTS ${PC_DBUS_LIBDIR}
                                  PATHS /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE})
  find_library(DBUS_LIBRARY NAMES dbus-1
                            HINTS ${PC_DBUS_LIBDIR})

  set(DBUS_VERSION ${PC_DBUS_VERSION})

  include(FindPackageHandleStandardArgs)
  find_package_handle_standard_args(DBus
                                    REQUIRED_VARS DBUS_LIBRARY DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR
                                    VERSION_VAR DBUS_VERSION)

  if(DBUS_FOUND)
    add_library(DBus::DBus UNKNOWN IMPORTED)
    set_target_properties(DBus::DBus PROPERTIES
                                   IMPORTED_LOCATION "${DBUS_LIBRARY}"
                                   INTERFACE_INCLUDE_DIRECTORIES "${DBUS_INCLUDE_DIR};${DBUS_ARCH_INCLUDE_DIR}"
                                   INTERFACE_COMPILE_DEFINITIONS HAS_DBUS=1)
    set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP DBus::DBus)
  endif()

  mark_as_advanced(DBUS_INCLUDE_DIR DBUS_LIBRARY)
endif()