aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/interpreter.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 3e64a67..7896f51 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3585,13 +3585,15 @@ external dependencies (including libraries) must go to "dependencies".''')
return self.notfound_dependency()
has_fallback = 'fallback' in kwargs
- if not has_fallback and name and required:
+ if not has_fallback and name:
# Add an implicit fallback if we have a wrap file or a directory with the same name,
# but only if this dependency is required. It is common to first check for a pkg-config,
# then fallback to use find_library() and only afterward check again the dependency
- # with a fallback.
+ # with a fallback. If the fallback has already been configured then we have to use it
+ # even if the dependency is not required.
provider = self.environment.wrap_resolver.find_dep_provider(name)
- if provider:
+ dirname = mesonlib.listify(provider)[0]
+ if provider and (required or dirname in self.subprojects):
kwargs['fallback'] = provider
has_fallback = True