aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Churaev <lamefun.x0r@gmail.com>2018-01-09 22:32:25 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2018-01-09 21:32:25 +0200
commit398aed6e4991016c0bba4ee829bf65f98f1a6447 (patch)
treef87c4fd9dfcf33afe5e98eacb3ddc06ba3c71b36
parent70902cefc3a25a00605c8a3023f292ea2e9a73d9 (diff)
downloadmeson-398aed6e4991016c0bba4ee829bf65f98f1a6447.zip
meson-398aed6e4991016c0bba4ee829bf65f98f1a6447.tar.gz
meson-398aed6e4991016c0bba4ee829bf65f98f1a6447.tar.bz2
Don't fail if we find an optional dependency but not the required information (#2652)
-rw-r--r--mesonbuild/dependencies/base.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 46cce43..b8787cc 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -400,11 +400,22 @@ class PkgConfigDependency(ExternalDependency):
m = 'Invalid version of dependency, need {!r} {!r} found {!r}.'
raise DependencyException(m.format(name, not_found, self.version))
return
- found_msg += [mlog.green('YES'), self.version]
- # Fetch cargs to be used while using this dependency
- self._set_cargs()
- # Fetch the libraries and library paths needed for using this
- self._set_libs()
+
+ try:
+ # Fetch cargs to be used while using this dependency
+ self._set_cargs()
+ # Fetch the libraries and library paths needed for using this
+ self._set_libs()
+ found_msg += [mlog.green('YES'), self.version]
+ except DependencyException as e:
+ if self.required:
+ raise
+ else:
+ self.compile_args = []
+ self.link_args = []
+ self.is_found = False
+ found_msg += [mlog.red('NO'), '; reason: {}'.format(str(e))]
+
# Print the found message only at the very end because fetching cflags
# and libs can also fail if other needed pkg-config files aren't found.
if not self.silent: