diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 31c680664..714562f87 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -30,6 +30,7 @@ if T.TYPE_CHECKING: from .._typing import ImmutableListProtocol from ..compilers.compilers import Compiler from ..environment import Environment + from ..interpreterbase import FeatureCheckBase from ..build import BuildTarget, CustomTarget, IncludeDirs from ..mesonlib import FileOrString @@ -92,6 +93,8 @@ class Dependency(HoldableObject): self.sources: T.List[T.Union['FileOrString', 'CustomTarget']] = [] self.include_type = self._process_include_type_kw(kwargs) self.ext_deps: T.List[Dependency] = [] + self.featurechecks: T.List['FeatureCheckBase'] = [] + self.feature_since: T.Optional[T.Tuple[str, str]] = None def __repr__(self) -> str: return f'<{self.__class__.__name__} {self.name}: {self.is_found}>' diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 380cc1dc9..2d891d9f7 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1601,6 +1601,11 @@ external dependencies (including libraries) must go to "dependencies".''') if wanted != actual: mlog.debug(f'Current include type of {args[0]} is {actual}. Converting to requested {wanted}') d = d.generate_system_dependency(wanted) + if d.feature_since is not None: + version, extra_msg = d.feature_since + FeatureNew.single_use(f'dep {d.name!r} custom lookup', version, self.subproject, extra_msg, node) + for f in d.featurechecks: + f.use(self.subproject, node) return d @FeatureNew('disabler', '0.44.0')