FindDBus.cmake revision a9364748fcbe81592d380ffa00b8ec000e308c5f
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# - Try to find the low-level D-Bus library
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# Once done this will define
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# DBUS_FOUND - system has D-Bus
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# DBUS_INCLUDE_DIR - the D-Bus include directory
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# DBUS_LIBRARIES - the libraries needed to use D-Bus
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# Redistribution and use is allowed according to the terms of the BSD license.
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Bartonif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton # in cache already
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton SET(DBUS_FOUND TRUE)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Bartonelse (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton IF (NOT WIN32)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton FIND_PACKAGE(PkgConfig)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton IF (PKG_CONFIG_FOUND)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton # use pkg-config to get the directories and then use these values
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton # in the FIND_PATH() and FIND_LIBRARY() calls
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton pkg_check_modules(_DBUS_PC QUIET dbus-1)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton ENDIF (PKG_CONFIG_FOUND)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton ENDIF (NOT WIN32)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton ${_DBUS_PC_INCLUDE_DIRS}
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton ${_DBUS_PC_INCLUDE_DIRS}
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton /usr/lib${LIB_SUFFIX}/include
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton ${_DBUS_PC_LIBDIR}
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton set(DBUS_FOUND TRUE)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton if (DBUS_FOUND)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton if (NOT DBus_FIND_QUIETLY)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton endif (NOT DBus_FIND_QUIETLY)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton else (DBUS_FOUND)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton if (DBus_FIND_REQUIRED)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton message(FATAL_ERROR "Could NOT find D-Bus")
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton endif (DBus_FIND_REQUIRED)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton endif (DBUS_FOUND)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Barton MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
a9364748fcbe81592d380ffa00b8ec000e308c5fCampbell Bartonendif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)