diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 59a8ef6a2cbd..7e41f02bd8c9 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -1084,6 +1084,7 @@ def get_option_internal(self, optname: str) -> options.UserOption: @noKwargs def func_get_option(self, nodes: mparser.BaseNode, args: T.Tuple[str], kwargs: 'TYPE_kwargs') -> T.Union[options.UserOption, 'TYPE_var']: + self.get_option_used = True optname = args[0] if ':' in optname: raise InterpreterException('Having a colon in option name is forbidden, ' @@ -1209,6 +1210,10 @@ def func_project(self, node: mparser.FunctionNode, args: T.Tuple[str, T.List[str else: FeatureNew.single_use('meson.options file', '1.1', self.subproject, 'Use meson_options.txt instead') + # Warn about using get_option() in project(). + if hasattr(self, 'get_option_used'): + FeatureNew.single_use('Using get_option() function as a parameter to project()', '1.7', self.subproject) + if self.subproject: self.project_default_options = {k.evolve(subproject=self.subproject): v for k, v in kwargs['default_options'].items()}