FindDBus.cmake 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
  9. # modeled after FindLibArt.cmake:
  10. # Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
  11. #
  12. # Redistribution and use is allowed according to the terms of the BSD license.
  13. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
  14. if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
  15. # in cache already
  16. SET(DBUS_FOUND TRUE)
  17. else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
  18. IF (NOT WIN32)
  19. FIND_PACKAGE(PkgConfig)
  20. IF (PKG_CONFIG_FOUND)
  21. # use pkg-config to get the directories and then use these values
  22. # in the FIND_PATH() and FIND_LIBRARY() calls
  23. pkg_check_modules(_DBUS_PC QUIET dbus-1)
  24. ENDIF (PKG_CONFIG_FOUND)
  25. ENDIF (NOT WIN32)
  26. FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
  27. ${_DBUS_PC_INCLUDE_DIRS}
  28. /usr/include
  29. /usr/include/dbus-1.0
  30. /usr/local/include
  31. )
  32. FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
  33. ${_DBUS_PC_INCLUDE_DIRS}
  34. /usr/lib${LIB_SUFFIX}/include
  35. /usr/lib${LIB_SUFFIX}/dbus-1.0/include
  36. /usr/lib64/include
  37. /usr/lib64/dbus-1.0/include
  38. /usr/lib/include
  39. /usr/lib/dbus-1.0/include
  40. )
  41. FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
  42. PATHS
  43. ${_DBUS_PC_LIBDIR}
  44. )
  45. if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
  46. set(DBUS_FOUND TRUE)
  47. endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
  48. if (DBUS_FOUND)
  49. if (NOT DBus_FIND_QUIETLY)
  50. message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
  51. endif (NOT DBus_FIND_QUIETLY)
  52. else (DBUS_FOUND)
  53. if (DBus_FIND_REQUIRED)
  54. message(FATAL_ERROR "Could NOT find D-Bus")
  55. endif (DBus_FIND_REQUIRED)
  56. endif (DBUS_FOUND)
  57. MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
  58. endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)