1 # DbusGlib library detection
3 # Copyright 2013 Thincast Technologies GmbH
4 # Copyright 2013 Armin Novak <armin.novak@thincast.com>
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
18 find_package(PkgConfig)
19 pkg_check_modules(PC_DBUS_GLIB QUIET dbus-glib-1)
20 set(DBUS_GLIB_DEFINITIONS ${PC_DBUS_GLIB_CFLAGS_OTHER})
22 find_path(DBUS_GLIB_INCLUDE_DIR dbus/dbus-glib.h
23 HINTS ${PC_DBUS_GLIB_INCLUDEDIR} ${PC_DBUS_GLIB_INCLUDE_DIRS}
24 PATH_SUFFIXES dbus-glib-1 )
26 find_library(DBUS_GLIB_LIBRARY NAMES dbus-glib-1 dbus-glib
27 HINTS ${PC_DBUS_GLIB_LIBDIR} ${PC_DBUS_GLIB_LIBRARY_DIRS} )
29 set(DBUS_GLIB_LIBRARIES ${DBUS_GLIB_LIBRARY} )
30 set(DBUS_GLIB_INCLUDE_DIRS ${DBUS_GLIB_INCLUDE_DIR} )
32 include(FindPackageHandleStandardArgs)
33 # handle the QUIETLY and REQUIRED arguments and set DBUS_GLIB_FOUND to TRUE
34 # if all listed variables are TRUE
35 find_package_handle_standard_args(dbus-glib DEFAULT_MSG
36 DBUS_GLIB_LIBRARY DBUS_GLIB_INCLUDE_DIR)
38 if(DBUS_GLIB_LIBRARIES AND DBUS_GLIB_INCLUDE_DIRS)
39 set(DBUS_GLIB_FOUND TRUE)
42 mark_as_advanced(DBUS_GLIB_INCLUDE_DIR DBUS_GLIB_LIBRARY)