Backported #6865: Disable websockets command line option
[platform/upstream/freerdp.git] / cmake / FindDBus.cmake
1 # - Try to find the low-level D-Bus library
2 # Once done this will define
3 #
4 #  DBUS_FOUND - system has D-Bus
5 #  DBUS_INCLUDE_DIR - the D-Bus include directory
6 #  DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory
7 #  DBUS_LIBRARIES - the libraries needed to use D-Bus
8
9 # Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
10 # modeled after FindLibArt.cmake:
11 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
12 #
13 # Redistribution and use is allowed according to the terms of the BSD license.
14 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15
16 if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
17
18   # in cache already
19   SET(DBUS_FOUND TRUE)
20
21 else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
22
23   IF (NOT WIN32)
24     FIND_PACKAGE(PkgConfig)
25     IF (PKG_CONFIG_FOUND)
26       # use pkg-config to get the directories and then use these values
27       # in the FIND_PATH() and FIND_LIBRARY() calls
28       pkg_check_modules(_DBUS_PC QUIET dbus-1)
29     ENDIF (PKG_CONFIG_FOUND)
30   ENDIF (NOT WIN32)
31
32   FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
33     ${_DBUS_PC_INCLUDE_DIRS}
34     /usr/include
35     /usr/include/dbus-1.0
36     /usr/local/include
37   )
38
39   FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
40     ${_DBUS_PC_INCLUDE_DIRS}
41     /usr/lib${LIB_SUFFIX}/include
42     /usr/lib${LIB_SUFFIX}/dbus-1.0/include
43     /usr/lib64/include
44     /usr/lib64/dbus-1.0/include
45     /usr/lib/include
46     /usr/lib/dbus-1.0/include
47   )
48
49   FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
50     PATHS
51      ${_DBUS_PC_LIBDIR}
52   )
53
54
55   if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
56      set(DBUS_FOUND TRUE)
57   endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
58
59
60   if (DBUS_FOUND)
61      if (NOT DBus_FIND_QUIETLY)
62         message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
63      endif (NOT DBus_FIND_QUIETLY)
64   else (DBUS_FOUND)
65      if (DBus_FIND_REQUIRED)
66         message(FATAL_ERROR "Could NOT find D-Bus")
67      endif (DBus_FIND_REQUIRED)
68   endif (DBUS_FOUND)
69
70   MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
71
72 endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
73