mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-22 14:23:10 -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>
45 lines
734 B
Batchfile
Executable File
45 lines
734 B
Batchfile
Executable File
@ECHO OFF
|
|
|
|
rem variables to get around `--static --version` printing the received
|
|
rem message and then version
|
|
set static=false
|
|
set print_errors=false
|
|
|
|
:LOOP
|
|
|
|
IF "%1"=="" (
|
|
EXIT /B 255
|
|
)
|
|
|
|
IF "%1"=="--version" (
|
|
ECHO 0.0-cmake-dummy
|
|
EXIT /B 0
|
|
)
|
|
|
|
IF "%1"=="--exists" (
|
|
SHIFT
|
|
ECHO Expected: %*
|
|
ECHO Found: %PKG_CONFIG_PATH%
|
|
IF NOT "%*"=="%PKG_CONFIG_PATH%" (
|
|
EXIT /B 1
|
|
) ELSE (
|
|
EXIT /B 0
|
|
)
|
|
)
|
|
IF "%1"=="--static" (
|
|
set static=true
|
|
)
|
|
IF "%1"=="--print-errors" (
|
|
set print_errors=true
|
|
)
|
|
SHIFT
|
|
IF NOT "%~1"=="" GOTO LOOP
|
|
|
|
IF "%static%"=="true" ECHO Received --static
|
|
IF "%print_errors%"=="true" ECHO Received --print-errors
|
|
|
|
IF "%static%"=="true" GOTO :EOF
|
|
IF "%print_errors%"=="true" GOTO :EOF
|
|
|
|
EXIT /B 255
|