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.
pull/3921/head
David Seifert 6 years ago committed by Jussi Pakkanen
parent e677f2f552
commit e0120b4586
  1. 12
      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

Loading…
Cancel
Save