not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / cmake / modules / FindDBus.cmake
bloba0b7c3af5f27f3732fc6d505f0703614489b80dd
1 # - Try to find the low-level D-Bus library
2 # Once done this will define
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
9 # Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
10 # modeled after FindLibArt.cmake:
11 # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
13 # Redistribution and use is allowed according to the terms of the BSD license.
14 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16 if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
18   # in cache already
19   SET(DBUS_FOUND TRUE)
21 else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
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 dbus-1)
29     ENDIF (PKG_CONFIG_FOUND)
30   ENDIF (NOT WIN32)
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   )
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   )
49   FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
50     PATHS
51      ${_DBUS_PC_LIBDIR}
52   )
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)
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)
70   MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
72 endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)