Debian Codegraph @

cmake/DBus1Config.pkgconfig.in

raw
1 # - Config file for the DBus1 package
2 # It defines the following variables
3 # DBus1_FOUND - Flag for indicating that DBus1 package has been found
4 # DBus1_DEFINITIONS - compile definitions for DBus1 [1]
5 # DBus1_INCLUDE_DIRS - include directories for DBus1 [1]
6 # DBus1_LIBRARIES - cmake targets to link against
7
8 # [1] This variable is not required if DBus1_LIBRARIES is added
9 # to a target with target_link_libraries
10
11 get_filename_component(DBus1_PKGCONFIG_DIR "${CMAKE_CURRENT_LIST_DIR}/../../pkgconfig" ABSOLUTE)
12 get_filename_component(DBus1_NEARBY_ARCH_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../../dbus-1.0/include" ABSOLUTE)
13 find_package(PkgConfig)
14 if(DEFINED ENV{PKG_CONFIG_DIR})
15 set(_dbus_pkgconfig_dir "$ENV{PKG_CONFIG_DIR}")
16 endif()
17 if(DEFINED ENV{PKG_CONFIG_PATH})
18 set(_dbus_pkgconfig_path "$ENV{PKG_CONFIG_PATH}")
19 endif()
20 if(DEFINED ENV{PKG_CONFIG_LIBDIR})
21 set(_dbus_pkgconfig_libdir "$ENV{PKG_CONFIG_LIBDIR}")
22 endif()
23 set(ENV{PKG_CONFIG_DIR})
24 set(ENV{PKG_CONFIG_PATH} ${DBus1_PKGCONFIG_DIR})
25 set(ENV{PKG_CONFIG_LIBDIR} ${DBus1_PKGCONFIG_DIR})
26 # for debugging
27 #set(ENV{PKG_CONFIG_DEBUG_SPEW} 1)
28 pkg_check_modules(PC_DBUS1 QUIET dbus-1)
29 if(DEFINED _dbus_pkgconfig_dir)
30 set(ENV{PKG_CONFIG_DIR} "${_dbus_pkgconfig_dir}")
31 else()
32 unset(ENV{PKG_CONFIG_DIR})
33 endif()
34 if(DEFINED _dbus_pkgconfig_path)
35 set(ENV{PKG_CONFIG_PATH} "${_dbus_pkgconfig_path}")
36 else()
37 unset(ENV{PKG_CONFIG_PATH})
38 endif()
39 if(DEFINED _dbus_pkgconfig_libdir)
40 set(ENV{PKG_CONFIG_LIBDIR} "${_dbus_pkgconfig_libdir}")
41 else()
42 unset(ENV{PKG_CONFIG_LIBDIR})
43 endif()
44 unset(_dbus_pkgconfig_dir)
45 unset(_dbus_pkgconfig_path)
46 unset(_dbus_pkgconfig_libdir)
47 set(DBus1_DEFINITIONS ${PC_DBUS1_CFLAGS_OTHER})
48
49 # find the real stuff and use pkgconfig variables as hints
50 # because cmake provides more search options
51 find_path(DBus1_INCLUDE_DIR dbus/dbus.h
52 HINTS ${PC_DBUS1_INCLUDEDIR} ${PC_DBUS1_INCLUDE_DIRS}
53 PATH_SUFFIXES dbus-1.0)
54 find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
55 PATHS ${DBus1_NEARBY_ARCH_INCLUDE_DIR}
56 NO_DEFAULT_PATH)
57 find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
58 HINTS ${PC_DBUS1_INCLUDE_DIRS}
59 PATH_SUFFIXES dbus-1.0)
60 find_library(DBus1_LIBRARY NAMES ${PC_DBUS1_LIBRARIES}
61 HINTS ${PC_DBUS1_LIBDIR} ${PC_DBUS1_LIBRARY_DIRS})
62
63 include(FindPackageHandleStandardArgs)
64 # handle the QUIETLY and REQUIRED arguments and set DBus1_FOUND to TRUE
65 # if all listed variables are TRUE
66 find_package_handle_standard_args(DBus1 DEFAULT_MSG
67 DBus1_LIBRARY DBus1_INCLUDE_DIR DBus1_ARCH_INCLUDE_DIR)
68
69 # make the mentioned variables only visible in cmake gui with "advanced" enabled
70 mark_as_advanced(DBus1_INCLUDE_DIR DBus1_LIBRARY)
71
72 set(DBus1_LIBRARIES dbus-1)
73 set(DBus1_INCLUDE_DIRS "${DBus1_INCLUDE_DIR}" "${DBus1_ARCH_INCLUDE_DIR}")
74
75 # setup imported target
76 add_library(dbus-1 SHARED IMPORTED)
77 set_property(TARGET dbus-1 APPEND PROPERTY IMPORTED_LOCATION ${DBus1_LIBRARY})
78 set_property(TARGET dbus-1 APPEND PROPERTY IMPORTED_IMPLIB ${DBus1_LIBRARY})
79 set_property(TARGET dbus-1 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${DBus1_INCLUDE_DIRS})
80 set_property(TARGET dbus-1 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS ${DBus1_DEFINITIONS})