dependency: Empty fallback is the same as allow_fallback: false
This commit is contained in:
parent
d729ea3f69
commit
5f3b73beb5
|
@ -515,6 +515,8 @@ This function supports the following keyword arguments:
|
|||
in this case the subproject must use
|
||||
`meson.override_dependency('dependency_name', subproj_dep)`
|
||||
to specify the dependency object used in the superproject.
|
||||
If the value is an empty list, it has the same effect as
|
||||
`allow_fallback: false`.
|
||||
- `language` *(since 0.42.0)*: defines what language-specific
|
||||
dependency to find if it's available for multiple languages.
|
||||
- `method`: defines the way the dependency is detected, the default is
|
||||
|
|
|
@ -47,6 +47,10 @@ class DependencyFallbacksHolder(InterpreterObject):
|
|||
location=self.interpreter.current_node)
|
||||
return
|
||||
fbinfo = stringlistify(fbinfo)
|
||||
if len(fbinfo) == 0:
|
||||
# dependency('foo', fallback: []) is the same as dependency('foo', allow_fallback: false)
|
||||
self.allow_fallback = False
|
||||
return
|
||||
if len(fbinfo) == 1:
|
||||
FeatureNew.single_use('Fallback without variable name', '0.53.0', self.subproject)
|
||||
subp_name, varname = fbinfo[0], None
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
project('empty fallback')
|
||||
|
||||
# There is a subproject named 'foo' that overrides that dependency,
|
||||
# but `fallback: []` should not allow to use it. Same behaviour than with
|
||||
# `allow_fallback: false`
|
||||
dependency('foo', fallback: [])
|
|
@ -0,0 +1,3 @@
|
|||
project('foo')
|
||||
|
||||
meson.override_dependency('foo', declare_dependency())
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"stdout": [
|
||||
{
|
||||
"line": "test cases/failing/115 empty fallback/meson.build:6:0: ERROR: Dependency \"foo\" not found, tried pkgconfig and cmake"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue