summaryrefslogtreecommitdiff
path: root/Modules/FindPkgConfig.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-05-12 13:11:02 -0400
committerBrad King <brad.king@kitware.com>2022-05-12 13:18:24 -0400
commit11c8da94d4d688f707d21923fa6a9cdbe229d807 (patch)
tree04d6d3388db7cea0c0965f49d4ec87f26ee025b8 /Modules/FindPkgConfig.cmake
parentad5bf708a60f5c5d1f58e245819f19164948705e (diff)
downloadcmake-11c8da94d4d688f707d21923fa6a9cdbe229d807.tar.gz
FindPkgConfig: Fix preservation of ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS}
Fix the ENV save/restore added by commit 36979f5b43 (FindPkgConfig: Tolerate PKG_CONFIG_SYSTEM_LIBRARY_PATH in environment, 2021-07-13, v3.22.0-rc1~407^2) to unset the variable if it was originally not set. While at it, clarify the value to which we temporarily set it. The `pkg-config` and `pkgconf` tools only check that the variable is set, and do not care about the value. Set it to a more true-looking value. Issue: #22148
Diffstat (limited to 'Modules/FindPkgConfig.cmake')
-rw-r--r--Modules/FindPkgConfig.cmake4
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 547bc520da..ab8af3e604 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -429,7 +429,7 @@ macro(_pkg_set_path_internal)
else()
unset(_pkgconfig_allow_system_libs_old)
endif()
- set(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS} 0)
+ set(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS} 1)
endmacro()
macro(_pkg_restore_path_internal)
@@ -440,6 +440,8 @@ macro(_pkg_restore_path_internal)
if(DEFINED _pkgconfig_allow_system_libs_old)
set(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS} "${_pkgconfig_allow_system_libs_old}")
unset(_pkgconfig_allow_system_libs_old)
+ else()
+ unset(ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS})
endif()
unset(_extra_paths)