summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-03-27 12:15:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-03-27 12:17:05 (GMT)
commitd0272bea0410b4f62aa509e035259fa57bd5b7c1 (patch)
tree389a6ab11d8f6748f3534fd9d7189d114e26ae65
parentd26526a36f58dd013bd73168c398899fceac3f0e (diff)
parentd0dd134bdb4763678e405b05d2ba8169cc0a0518 (diff)
downloadCMake-d0272bea0410b4f62aa509e035259fa57bd5b7c1.zip
CMake-d0272bea0410b4f62aa509e035259fa57bd5b7c1.tar.gz
CMake-d0272bea0410b4f62aa509e035259fa57bd5b7c1.tar.bz2
Merge topic 'FindPkgConfig-no-Strawberry-Perl' into release-3.29
d0dd134bdb FindPkgConfig: Avoid finding Strawberry Perl's pkg-config Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: scivision <michael@scivision.dev> Merge-request: !9375
-rw-r--r--Modules/FindPkgConfig.cmake17
1 files changed, 16 insertions, 1 deletions
diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 1b6a72a..f3bacc3 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -56,14 +56,29 @@ endif()
set(PKG_CONFIG_NAMES "pkg-config")
if(CMAKE_HOST_WIN32)
list(PREPEND PKG_CONFIG_NAMES "pkg-config.bat")
+ set(_PKG_CONFIG_VALIDATOR VALIDATOR __FindPkgConfig_EXECUTABLE_VALIDATOR)
+ function(__FindPkgConfig_EXECUTABLE_VALIDATOR result_var candidate)
+ if(candidate MATCHES "\\.[Ee][Xx][Ee]$")
+ return()
+ endif()
+ # Exclude the pkg-config distributed with Strawberry Perl.
+ execute_process(COMMAND "${candidate}" --help OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _result)
+ if(NOT _result EQUAL 0 OR _output MATCHES "Pure-Perl")
+ set("${result_var}" FALSE PARENT_SCOPE)
+ endif()
+ endfunction()
+else()
+ set(_PKG_CONFIG_VALIDATOR "")
endif()
list(APPEND PKG_CONFIG_NAMES "pkgconf")
find_program(PKG_CONFIG_EXECUTABLE
NAMES ${PKG_CONFIG_NAMES}
NAMES_PER_DIR
- DOC "pkg-config executable")
+ DOC "pkg-config executable"
+ ${_PKG_CONFIG_VALIDATOR})
mark_as_advanced(PKG_CONFIG_EXECUTABLE)
+unset(_PKG_CONFIG_VALIDATOR)
set(PKG_CONFIG_ARGN "${PKG_CONFIG_ARGN}" CACHE STRING "Arguments to supply to pkg-config")
mark_as_advanced(PKG_CONFIG_ARGN)