Debian Codegraph @

cmake/FindGLib.cmake

raw
1 # - Try to find
2 # Once done, this will define
3 #
4 # GLib_FOUND - system has GLib
5 # GLib_INCLUDE_DIRS - the GLib include directories
6 # GLib_LIBRARIES - link these to use GLib
7
8 include(LibFindMacros)
9
10 # Dependencies
11 # The current package name (GLib) is included as first paramater in order to foward the REQUIRED or QUIET paramaters
12 # to the find_package for the dependent library (ie Threads)
13 #libfind_package(GLib)
14
15 # Use pkg-config to get hints about paths
16 libfind_pkg_check_modules(GLib_PKGCONF glib-2.0)
17
18 # Include dir
19 find_path(GLib_INCLUDE_DIR
20 NAMES glib.h
21 HINTS ${GLib_PKGCONF_INCLUDE_DIRS}
22 )
23 # glibconfig.h is located in a different directory, so include it here
24 find_path(GLibconfig_INCLUDE_DIR
25 NAMES glibconfig.h
26 HINTS ${GLib_PKGCONF_INCLUDE_DIRS})
27
28 # Finally the library itself
29 find_library(GLib_LIBRARY
30 NAMES glib-2.0
31 HINTS ${GLib_PKGCONF_LIBRARY_DIRS}
32 )
33
34 # Set the include dir variables and the libraries and let libfind_process do the rest.
35 # NOTE: Singular variables for this library, plural for libraries this this lib depends on.
36 set(GLib_PROCESS_INCLUDES GLib_INCLUDE_DIR GLibconfig_INCLUDE_DIR)
37 set(GLib_PROCESS_LIBS GLib_LIBRARY)
38 libfind_process(GLib)