mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-23 14:48:19 -05:00
35d3e00e4e
It's common for some people to use the PKG_CONFIG environment variable to not only load a custom pkg-config/pkgconf but also to load some default arguments such as `--static` or `--keep-system-libs` which often worked since shell scripts would call `$PKG_CONFIG --libs pkg` without quotes, but this breaks FindPkgConfig since it uses the full string as `argv[0]` and might try looking for a binary called `pkgconf --static`, instead of looking for `pkgconf` and adding `--static` as the `argv[1]` Additionally adds RunCMake.FindPkgConfig ARGN test case Fixes: #22305 Signed-off-by: Christopher Degawa <ccom@randomderp.com>
18 lines
617 B
CMake
18 lines
617 B
CMake
if(WIN32)
|
|
set(ENV{PKG_CONFIG} "\"${CMAKE_CURRENT_SOURCE_DIR}\\dummy-pkg-config.bat\" --static --print-errors")
|
|
else()
|
|
set(ENV{PKG_CONFIG} "\"${CMAKE_CURRENT_SOURCE_DIR}/dummy-pkg-config.sh\" --static --print-errors")
|
|
endif()
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
if(NOT PKG_CONFIG_ARGN STREQUAL "--static;--print-errors")
|
|
message(SEND_ERROR "PKG_CONFIG_ARGN has wrong value '${PKG_CONFIG_ARGN}'")
|
|
endif()
|
|
|
|
_pkgconfig_invoke("none" "prefix" "output" "")
|
|
|
|
if(NOT prefix_output STREQUAL "Received;--static;Received;--print-errors")
|
|
message(SEND_ERROR "prefix_output has wrong value '${prefix_output}'")
|
|
endif()
|