include_type: honor include_type in dependency fallbacks (fixes #7503)

This commit is contained in:
Daniel Mensinger 2020-10-13 16:10:29 +02:00 committed by Jussi Pakkanen
parent 3372c58ca6
commit e00df9046d
2 changed files with 11 additions and 0 deletions

View File

@ -3687,9 +3687,17 @@ external dependencies (including libraries) must go to "dependencies".''')
if not_found_message:
self.message_impl([not_found_message])
raise
assert isinstance(d, DependencyHolder)
if not d.found() and not_found_message:
self.message_impl([not_found_message])
self.message_impl([not_found_message])
# Ensure the correct include type
if 'include_type' in kwargs:
wanted = kwargs['include_type']
actual = d.include_type_method([], {})
if wanted != actual:
mlog.debug('Current include type of {} is {}. Converting to requested {}'.format(name, actual, wanted))
d = d.as_system_method([wanted], {})
# Override this dependency to have consistent results in subsequent
# dependency lookups.
if name and d.found():

View File

@ -33,6 +33,9 @@ sp_dep_sys = sp_dep.as_system('system')
assert(sp_dep_sys.include_type() == 'system', 'changing include_type works')
assert(sp_dep.include_type() == 'preserve', 'as_system must not mutate the original object')
fallback = dependency('sdffgagf_does_not_exist', include_type: 'system', fallback: ['subDep', 'subDep_dep'])
assert(fallback.include_type() == 'system', 'include_type works with dependency fallback')
# Check that PCH works with `include_type : 'system'` See https://github.com/mesonbuild/meson/issues/7167
main_exe = executable('main_exe', 'main.cpp', cpp_pch: 'pch/test.hpp', dependencies: boost_dep)
test('main_test', main_exe)