CMake/Tests/RunCMake/FindPkgConfig/dummy-pkg-config.sh
Benjamin Chrétien 1bfb527f56 FindPkgConfig: return actual error when a package is not found (#15810)
In some cases, CMake returned the following error:

-- Checking for module 'foo'
--   Package 'foo' not found

When the actual error returned by pkg-config was:

  Package 'bar', required by 'foo', not found

Now, the actual error is forwarded to the user.

-- Checking for module 'foo'
--   Package 'bar', required by 'foo', not found

For the standard case (i.e. the package was indeed not found), the
CMake error was:

-- Checking for module 'foo'
--   Package 'foo' not found

But it now prints:

-- Checking for module 'foo'
--   No package 'foo' found

The associated test was also updated. ${last} refers to the last
CLI argument.
2015-10-28 10:18:15 -04:00

22 lines
453 B
Bash
Executable File

#!/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.
case $1 in
--version)
echo "0.0-cmake-dummy"
;;
--exists)
shift
eval last=\${$#}
echo "Expected: ${last}"
echo "Found: ${PKG_CONFIG_PATH}"
[ "${last}" = "${PKG_CONFIG_PATH}" ] || exit 1
;;
*)
exit 255
;;
esac