diff options
author | Barnabás Pőcze <pobrn@protonmail.com> | 2024-06-01 21:26:49 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2024-06-23 22:33:37 +0300 |
commit | eba5498e9b40fdc6fd7d9621a9262dbd8364ea62 (patch) | |
tree | 79c23bb6d1c9c9a0cbbd0e5f2001d12ed03240e5 | |
parent | 03ffb5bd6f2e441227e0a1758b258c2a4d3d58d7 (diff) | |
download | meson-eba5498e9b40fdc6fd7d9621a9262dbd8364ea62.zip meson-eba5498e9b40fdc6fd7d9621a9262dbd8364ea62.tar.gz meson-eba5498e9b40fdc6fd7d9621a9262dbd8364ea62.tar.bz2 |
compilers: cpp: fix header name and return value use in header check
There are two issues:
1. has_header() wants just the header name without surrounding <>
or similar; it fails otherwise.
2. has_header() returns a tuple of two bools, where the first element
determines whether or not the header has been found. So use
that element specifically, otherwise the tuple will always evaluate
to true because it is not empty.
Fixes: 675b47b0692131 ("compilers: cpp: improve libc++ vs libstdc++ detection (again)")
-rw-r--r-- | mesonbuild/compilers/cpp.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index df2f905..9467a35 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -185,7 +185,7 @@ class _StdCPPLibMixin(CompilerMixinBase): def language_stdlib_provider(self, env: Environment) -> str: # https://stackoverflow.com/a/31658120 - header = 'version' if self.has_header('<version>', '', env) else 'ciso646' + header = 'version' if self.has_header('version', '', env)[0] else 'ciso646' is_libcxx = self.has_header_symbol(header, '_LIBCPP_VERSION', '', env)[0] lib = 'c++' if is_libcxx else 'stdc++' return lib |