| 1 |
find_package(PkgConfig) |
| 2 |
if (PKG_CONFIG_FOUND) |
| 3 |
if (APPLE) |
| 4 |
# libffi is provided by base system so brew does not take the risk to override it |
| 5 |
# hence then need for an explicit look-up |
| 6 |
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:/usr/local/opt/libffi/lib/pkgconfig") |
| 7 |
endif () |
| 8 |
if (GLIB_FIND_REQUIRED) |
| 9 |
set(_pkgconfig_REQUIRED REQUIRED) |
| 10 |
endif () |
| 11 |
pkg_check_modules(GLIB ${_pkgconfig_REQUIRED} glib-2.0) |
| 12 |
if (GLIB_LINK_LIBRARIES) |
| 13 |
set(GLIB_LIBRARIES ${GLIB_LINK_LIBRARIES}) # HACK |
| 14 |
endif () |
| 15 |
else () |
| 16 |
find_path(GLIB_INCLUDE_DIRS glib.h) |
| 17 |
find_library(GLIB_LIBRARIES glib-2.0) |
| 18 |
if (GLIB_INCLUDE_DIRS AND GLIB_LIBRARIES) |
| 19 |
set(GLIB_FOUND 1) |
| 20 |
if (NOT GLIB_FIND_QUIETLY) |
| 21 |
message(STATUS "Found GLIB: ${GLIB_LIBRARIES}") |
| 22 |
endif () |
| 23 |
elseif (GLIB_FIND_REQUIRED) |
| 24 |
message(SEND_ERROR "Could not find GLIB") |
| 25 |
elseif (NOT GLIB_FIND_QUIETLY) |
| 26 |
message(STATUS "Could not find GLIB") |
| 27 |
endif () |
| 28 |
endif () |
| 29 |
mark_as_advanced(GLIB_INCLUDE_DIRS GLIB_LIBRARIES) |