FindGTK2: Find arch-specific headers via pkg-config

Fixes: #25884
This commit is contained in:
Maxim Cournoyer
2024-04-10 12:45:12 -04:00
committed by Brad King
parent 1a315c55e3
commit 7e49b98219

View File

@@ -306,6 +306,10 @@ function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
endif()
find_path(GTK2_${_var}_INCLUDE_DIR ${_hdr}
PATHS
${PC_GLIB2_INCLUDEDIR}
${PC_GLIB2_LIBDIR}
${PC_GTK2_INCLUDEDIR}
${PC_GTK2_LIBDIR}
${_gtk2_arch_dir}
/usr/local/libx32
/usr/local/lib64
@@ -616,6 +620,23 @@ if(NOT GTK2_FIND_COMPONENTS)
set(GTK2_FIND_COMPONENTS gtk)
endif()
# Retrieve LIBDIR from the GTK2 and GLIB2 pkg-config files, which are
# used to compute the arch-specific include prefixes. While at it,
# also retrieve their INCLUDEDIR, to accommodate non-standard layouts.
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_GTK2 QUIET gtk+-2.0)
if(PC_GTK2_FOUND)
pkg_get_variable(PC_GTK2_INCLUDEDIR gtk+-2.0 includedir)
pkg_get_variable(PC_GTK2_LIBDIR gtk+-2.0 libdir)
endif()
pkg_check_modules(PC_GLIB2 QUIET glib-2.0)
if(PC_GLIB2_FOUND)
pkg_get_variable(PC_GLIB2_INCLUDEDIR glib-2.0 includedir)
pkg_get_variable(PC_GLIB2_LIBDIR glib-2.0 libdir)
endif()
endif()
#
# If specified, enforce version number
#