subproject handling: add fix
@@ -2172,7 +2172,17 @@ to directly access options of other subprojects.''')
# a higher level project, try to use it first.
if 'fallback' in kwargs:
dirname, varname = self.get_subproject_infos(kwargs)
+ required = kwargs.get('required', True)
+ wanted = kwargs.get('version', 'undefined')
+ if not isinstance(required, bool):
+ raise DependencyException('Keyword "required" must be a boolean.')
if dirname in self.subprojects:
+ found = self.subprojects[dirname].held_object.project_version
+ valid_version = wanted == 'undefined' or mesonlib.version_compare(found, wanted)
+ if required and not valid_version:
+ m = 'Version {} of {} already loaded, requested incompatible version {}'
+ raise DependencyException(m.format(found, dirname, wanted))
+ elif valid_version:
subproject = self.subprojects[dirname]
try:
# Never add fallback deps to self.coredata.deps
