Add version info to dbus-1 target for non msvc builds on Windows too
[platform/upstream/dbus.git] / cmake / DBus1Config.pkgconfig.in
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 find_package(PkgConfig)
13 set(ENV{PKG_CONFIG_DIR})
14 set(ENV{PKG_CONFIG_PATH} ${DBus1_PKGCONFIG_DIR})
15 set(ENV{PKG_CONFIG_LIBDIR} ${DBus1_PKGCONFIG_DIR})
16 # for debugging
17 #set(ENV{PKG_CONFIG_DEBUG_SPEW} 1)
18 pkg_check_modules(PC_DBUS1 QUIET dbus-1)
19 set(DBus1_DEFINITIONS ${PC_DBUS1_CFLAGS_OTHER})
20
21 # find the real stuff and use pkgconfig variables as hints
22 # because cmake provides more search options
23 find_path(DBus1_INCLUDE_DIR dbus/dbus.h
24     HINTS ${PC_DBUS1_INCLUDEDIR} ${PC_DBUS1_INCLUDE_DIRS}
25     PATH_SUFFIXES dbus-1.0)
26 find_path(DBus1_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
27     HINTS ${PC_DBUS1_INCLUDE_DIRS}
28     PATH_SUFFIXES dbus-1.0)
29 find_library(DBus1_LIBRARY NAMES ${PC_DBUS1_LIBRARIES}
30     HINTS ${PC_DBUS1_LIBDIR} ${PC_DBUS1_LIBRARY_DIRS})
31
32 include(FindPackageHandleStandardArgs)
33 # handle the QUIETLY and REQUIRED arguments and set DBus1_FOUND to TRUE
34 # if all listed variables are TRUE
35 find_package_handle_standard_args(DBus1 DEFAULT_MSG
36     DBus1_LIBRARY DBus1_INCLUDE_DIR DBus1_ARCH_INCLUDE_DIR)
37
38 # make the mentioned variables only visible in cmake gui with "advanced" enabled
39 mark_as_advanced(DBus1_INCLUDE_DIR DBus1_LIBRARY)
40
41 set(DBus1_LIBRARIES dbus-1)
42 set(DBus1_INCLUDE_DIRS "${DBus1_INCLUDE_DIR}" "${DBus1_ARCH_INCLUDE_DIR}")
43
44 # setup imported target
45 add_library(dbus-1 SHARED IMPORTED)
46 set_property(TARGET dbus-1 APPEND PROPERTY IMPORTED_LOCATION ${DBus1_LIBRARY})
47 set_property(TARGET dbus-1 APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${DBus1_INCLUDE_DIRS})
48 set_property(TARGET dbus-1 APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS ${DBus1_DEFINITIONS})