Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't check version for fallback not-found dependency #3987

Merged
merged 1 commit into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions mesonbuild/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2814,6 +2814,12 @@ def _find_cached_fallback_dep(self, name, dirname, varname, wanted, required):
if not dep:
return False
found = dep.version_method([], {})
# Don't do a version check if the dependency is not found and not required
if found == 'none' and not required:
subproj_path = os.path.join(self.subproject_dir, dirname)
mlog.log('Dependency', mlog.bold(name), 'from subproject',
mlog.bold(subproj_path), 'found:', mlog.red('NO'), '(cached)')
return dep
if self.check_subproject_version(wanted, found):
subproj_path = os.path.join(self.subproject_dir, dirname)
mlog.log('Dependency', mlog.bold(name), 'from subproject',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
project('beta project', 'c')

lb = shared_library('b', 'b.c')
notfound = dependency('', required : false)
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ project('gamma project', 'c', subproject_dir: 'contrib/subprojects')
a = subproject('alpha')
lib = a.get_variable('l')

# Ensure that the dependency version is not checked for a not-found dependency
notfound = dependency('', version : '>=1.0', required : false,
fallback : ['beta', 'notfound'])

exe = executable('prog', 'prog.c', link_with : lib)
test('basic', exe)