From 8596b3bcd12371ad16e5ffbd3e34953603cd1484 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 22 Jul 2021 12:01:01 +0200 Subject: interpreter: detect and pass compiler to be used for linker tests Allow using the links method to test that the C++ driver (e.g. g++) can be used to link C objects. One usecase is that the C compiler's libsanitizer might not be compatible with the one included by the C++ driver. This is theoretically backwards-incompatible, but it should be treated as a bugfix in my opinion. There is no way in Meson to compile a .c file with the C++ driver as part of a build target, therefore there would be no reason to do something like meson.get_compiler(meson.get_compiler('cpp').links(files('main.c')). Fixes: #7703 --- mesonbuild/mesonlib/universal.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'mesonbuild/mesonlib') diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index 1680541..f81c01a 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -421,6 +421,10 @@ class File(HoldableObject): absdir = builddir return os.path.join(absdir, self.relative_name()) + @property + def suffix(self) -> str: + return os.path.splitext(self.fname)[1][1:].lower() + def endswith(self, ending: str) -> bool: return self.fname.endswith(ending) -- cgit v1.1