summaryrefslogtreecommitdiff
path: root/test cases/linuxlike
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-12-19 20:56:07 -0500
committerXavier Claessens <xavier.claessens@collabora.com>2020-03-06 15:25:46 -0500
commit2fdedc4d0fc73c509669bf9f89863017e0f0989b (patch)
treefcb933a45797f7a1a1ef4516ba709dfd0888f781 /test cases/linuxlike
parent74769617907f571d2099001d3a7443e23b4f6cda (diff)
downloadmeson-2fdedc4d0fc73c509669bf9f89863017e0f0989b.tar.gz
Add meson.override_dependency()
Similar to meson.override_find_program() but overrides the result of the dependency() function. Also ensure that dependency() always returns the same result when looking for the same dependency, this fixes cases where parts of the project could be using a system library and other parts use the library provided by a subproject.
Diffstat (limited to 'test cases/linuxlike')
-rw-r--r--test cases/linuxlike/5 dependency versions/meson.build19
1 files changed, 13 insertions, 6 deletions
diff --git a/test cases/linuxlike/5 dependency versions/meson.build b/test cases/linuxlike/5 dependency versions/meson.build
index 087db5ff7..cb58a64d7 100644
--- a/test cases/linuxlike/5 dependency versions/meson.build
+++ b/test cases/linuxlike/5 dependency versions/meson.build
@@ -38,32 +38,32 @@ somelibver = dependency('somelib',
fallback : ['somelibnover', 'some_dep'])
assert(somelibver.type_name() == 'internal', 'somelibver should be of type "internal", not ' + somelibver.type_name())
# Find an internal dependency again with the same name and a specific version
-somelib = dependency('somelib',
+somelib = dependency('somelib2',
version : '== 0.1',
fallback : ['somelib', 'some_dep'])
# Find an internal dependency again even if required = false
-somelib_reqfalse = dependency('somelib',
+somelib_reqfalse = dependency('somelib3',
required: false,
fallback : ['somelib', 'some_dep'])
assert(somelib_reqfalse.found(), 'somelib should have been found')
# Find an internal dependency again with the same name and incompatible version
-somelibver = dependency('somelib',
+somelibver = dependency('somelib4',
version : '>= 0.3',
fallback : ['somelibver', 'some_dep'])
# Find an internal dependency again with impossible multi-version
-somelibver = dependency('somelib',
+somelibver = dependency('somelib5',
version : ['>= 0.3', '<0.3'],
required : false,
fallback : ['somelibver', 'some_dep'])
assert(not somelibver.found(), 'Dependency should not be found')
# Find somelib again, but with a fallback that will fail because subproject does not exist
-somelibfail = dependency('somelib',
+somelibfail = dependency('somelib6',
version : '>= 0.2',
required : false,
fallback : ['somelibfail', 'some_dep'])
assert(somelibfail.found() == false, 'somelibfail found via wrong fallback')
# Find somelib again, but with a fallback that will fail because dependency does not exist
-somefail_dep = dependency('somelib',
+somefail_dep = dependency('somelib7',
version : '>= 0.2',
required : false,
fallback : ['somelib', 'somefail_dep'])
@@ -79,6 +79,13 @@ fakezlib_dep = dependency('fakezlib',
fallback : ['somelib', 'fakezlib_dep'])
assert(fakezlib_dep.type_name() == 'internal', 'fakezlib_dep should be of type "internal", not ' + fakezlib_dep.type_name())
+# Verify that once we got a system dependency, we won't fallback if a newer
+# version is requested.
+d = dependency('zlib', version: '>= 999',
+ fallback : ['somelib', 'some_dep'],
+ required: false)
+assert(not d.found(), 'version should not match and it should not fallback')
+
# Check that you can find a dependency by not specifying a version after not
# finding it by specifying a version. We add `static: true` here so that the
# previously cached zlib dependencies don't get checked.