diff options
author | David Seifert <soap@gentoo.org> | 2018-08-14 10:55:06 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-08-20 20:26:18 +0300 |
commit | e0120b4586225a41e08af936bf3e04f4db78ac6f (patch) | |
tree | 2b6bfd7accee8f85805f1f3a218b6179cef5cbc7 /mesonbuild/compilers/cpp.py | |
parent | e677f2f552d99748d7d145c2a93e94a16d56d2c5 (diff) | |
download | meson-e0120b4586225a41e08af936bf3e04f4db78ac6f.zip meson-e0120b4586225a41e08af936bf3e04f4db78ac6f.tar.gz meson-e0120b4586225a41e08af936bf3e04f4db78ac6f.tar.bz2 |
Remap -std=c++14 dialect names for older compilers
* GCC 4.8 and Clang 3.2, 3.3, 3.4 only understand
`-std={c,gnu}++1y` for enabling C++14 dialects.
GCC 4.8 is especially important as it is the basis
of RHEL/CentOS 7.
Diffstat (limited to 'mesonbuild/compilers/cpp.py')
-rw-r--r-- | mesonbuild/compilers/cpp.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 6483e54..d8203dd 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -89,7 +89,11 @@ class ClangCPPCompiler(ClangCompiler, CPPCompiler): args = [] std = options['cpp_std'] if std.value != 'none': - args.append('-std=' + std.value) + cpp_std_value = std.value + # Clang 3.2, 3.3, 3.4 only understand -std={c,gnu}++1y and not -std={c,gnu}++14 + if version_compare(self.version, '>=3.2') and version_compare(self.version, '<3.5'): + cpp_std_value = cpp_std_value.replace('++14', '++1y') + args.append('-std=' + cpp_std_value) return args def get_option_link_args(self, options): @@ -155,7 +159,11 @@ class GnuCPPCompiler(GnuCompiler, CPPCompiler): args = [] std = options['cpp_std'] if std.value != 'none': - args.append('-std=' + std.value) + cpp_std_value = std.value + # GCC 4.8 only understands -std={c,gnu}++1y and not -std={c,gnu}++14 + if version_compare(self.version, '>=4.8') and version_compare(self.version, '<4.9'): + cpp_std_value = cpp_std_value.replace('++14', '++1y') + args.append('-std=' + cpp_std_value) if options['cpp_debugstl'].value: args.append('-D_GLIBCXX_DEBUG=1') return args |