From 3dea817a597e4d2f10bfe3c1e006a0983555ad15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Fri, 24 Jul 2020 15:52:06 +0200 Subject: Only emit warning about "native:" on projects with minimum required version 'native:' keyword was only added in 0.54. For projects declaring meson_version >= 0.54, warn, because those projects can and should set the keyword. For older projects declaring support for older versions, don't warn and use the default implicitly. Fixes https://github.com/mesonbuild/meson/issues/6849. --- mesonbuild/interpreter.py | 7 +++++-- test cases/warning/2 languages missing native/meson.build | 3 ++- test cases/warning/2 languages missing native/test.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index df81569..45813c1 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -3122,8 +3122,11 @@ external dependencies (including libraries) must go to "dependencies".''') return self.add_languages(args, required, self.machine_from_native_kwarg(kwargs)) else: # absent 'native' means 'both' for backwards compatibility - mlog.warning('add_languages is missing native:, assuming languages are wanted for both host and build.', - location=self.current_node) + tv = FeatureNew.get_target_version(self.subproject) + if FeatureNew.check_version(tv, '0.54.0'): + mlog.warning('add_languages is missing native:, assuming languages are wanted for both host and build.', + location=self.current_node) + success = self.add_languages(args, False, MachineChoice.BUILD) success &= self.add_languages(args, required, MachineChoice.HOST) return success diff --git a/test cases/warning/2 languages missing native/meson.build b/test cases/warning/2 languages missing native/meson.build index f4aa956..e204715 100644 --- a/test cases/warning/2 languages missing native/meson.build +++ b/test cases/warning/2 languages missing native/meson.build @@ -1,2 +1,3 @@ -project('languages missing native') +project('languages missing native', + meson_version : '>= 0.54') add_languages('c') diff --git a/test cases/warning/2 languages missing native/test.json b/test cases/warning/2 languages missing native/test.json index 36da0a7..f929654 100644 --- a/test cases/warning/2 languages missing native/test.json +++ b/test cases/warning/2 languages missing native/test.json @@ -1,7 +1,7 @@ { "stdout": [ { - "line": "test cases/warning/2 languages missing native/meson.build:2: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build." + "line": "test cases/warning/2 languages missing native/meson.build:3: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build." } ] } -- cgit v1.1