|
| 1 | +From c1db93be859b360b64fe20d49a286278b56df64e Mon Sep 17 00:00:00 2001 |
| 2 | +From: Paolo Bonzini <pbonzini@redhat.com> |
| 3 | +Date: Tue, 3 Feb 2026 12:56:36 +0100 |
| 4 | +Subject: [PATCH] ninjabackend: do not fail if only the build machine uses C++ |
| 5 | + |
| 6 | +This is caused by the introduction of the cpp_importstd option; while |
| 7 | +target_uses_import_std() tries to protect from the option not existing, |
| 8 | +this does not work if cpp_importstd exists but build.cpp_importstd does |
| 9 | +not, and get_option_for_target() wants to look at the latter. |
| 10 | + |
| 11 | +Just return false on a KeyError for simplicity. |
| 12 | + |
| 13 | +Fixes: #15497 |
| 14 | +Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
| 15 | +--- |
| 16 | + mesonbuild/backend/ninjabackend.py | 8 ++++---- |
| 17 | + 1 file changed, 4 insertions(+), 4 deletions(-) |
| 18 | + |
| 19 | +diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py |
| 20 | +index 42f24d47d181..e0aaa39c43ce 100644 |
| 21 | +--- a/mesonbuild/backend/ninjabackend.py |
| 22 | ++++ b/mesonbuild/backend/ninjabackend.py |
| 23 | +@@ -3297,11 +3297,11 @@ def quote_make_target(targetName: str) -> str: |
| 24 | + def target_uses_import_std(self, target: build.BuildTarget) -> bool: |
| 25 | + if 'cpp' not in target.compilers: |
| 26 | + return False |
| 27 | +- if 'cpp_importstd' not in self.environment.coredata.optstore: |
| 28 | +- return False |
| 29 | +- if self.environment.coredata.get_option_for_target(target, 'cpp_importstd') == 'false': |
| 30 | ++ try: |
| 31 | ++ if self.environment.coredata.get_option_for_target(target, 'cpp_importstd') == 'true': |
| 32 | ++ return True |
| 33 | ++ except KeyError: |
| 34 | + return False |
| 35 | +- return True |
| 36 | + |
| 37 | + def handle_cpp_import_std(self, target: build.BuildTarget, compiler): |
| 38 | + istd_args = [] |
0 commit comments