diff options
author | Cristian Le <cristian.le@mpsd.mpg.de> | 2023-09-05 17:18:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2023-09-06 16:17:39 (GMT) |
commit | 252c66c697e163c192938fd0ee64aacc7626ee60 (patch) | |
tree | 299ad9675413c17c9124e40509bf20331054d276 /Modules | |
parent | 45078831351f3276a8f1b124eada532f66f6903b (diff) | |
download | CMake-252c66c697e163c192938fd0ee64aacc7626ee60.zip CMake-252c66c697e163c192938fd0ee64aacc7626ee60.tar.gz CMake-252c66c697e163c192938fd0ee64aacc7626ee60.tar.bz2 |
FindPkgConfig: Tolerate PKG_CONFIG_SYSTEM_INCLUDE_PATH in environment
Tell `pkg-config --cflags` not to filter out `-I` flags for entries of
`PKG_CONFIG_SYSTEM_INCLUDE_PATH` (and `CPATH` for `pkgconf`).
Fixes: #25228
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindPkgConfig.cmake | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 02f7fb4..4d29f45 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -425,13 +425,19 @@ macro(_pkg_set_path_internal) unset(_pkgconfig_path) endif() - # Tell pkg-config not to strip any -L paths so we can search them all. + # Tell pkg-config not to strip any -I or -L paths so we can search them all. if(DEFINED ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS}) set(_pkgconfig_allow_system_libs_old "$ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS}") else() unset(_pkgconfig_allow_system_libs_old) endif() set(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS} 1) + if(DEFINED ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS}) + set(_pkgconfig_allow_system_cflags_old "$ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS}") + else() + unset(_pkgconfig_allow_system_cflags_old) + endif() + set(ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS} 1) endmacro() macro(_pkg_restore_path_internal) @@ -445,6 +451,12 @@ macro(_pkg_restore_path_internal) else() unset(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS}) endif() + if(DEFINED _pkgconfig_allow_system_cflags_old) + set(ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS} "${_pkgconfig_allow_system_cflags_old}") + unset(_pkgconfig_allow_system_cflags_old) + else() + unset(ENV{PKG_CONFIG_ALLOW_SYSTEM_CFLAGS}) + endif() unset(_extra_paths) unset(_pkgconfig_path_old) |