cmake/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh

43 lines
876 B
Bash
Raw Normal View History

2015-04-27 22:25:09 +02:00
#!/bin/sh
# This is a replacement for pkg-config that compares the string passed
# to the --exists argument with the PKG_CONFIG_PATH environment variable
# and returns 1 if they are different.
2021-11-20 13:41:27 +01:00
# variables to get around `--static --version` printing the received
# message and then version
static=false
print_errors=false
2017-07-20 19:35:53 +02:00
while [ $# -gt 0 ]; do
case $1 in
--version)
echo "0.0-cmake-dummy"
exit 0
;;
--exists)
shift
eval last=\${$#}
echo "Expected: ${last}"
echo "Found: ${PKG_CONFIG_PATH}"
[ "${last}" = "${PKG_CONFIG_PATH}" ] && exit 0 || exit 1
;;
2021-11-20 13:41:27 +01:00
--static)
static=true
;;
--print-errors)
print_errors=true
;;
2017-07-20 19:35:53 +02:00
esac
shift
done
2021-11-20 13:41:27 +01:00
$static && echo "Received --static"
$print_errors && echo "Received --print-errors"
if $static || $print_errors; then
exit 0
fi
2017-07-20 19:35:53 +02:00
exit 255