From c54dd63547b030e3d9feee694ec6f49c434f0df8 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Sat, 8 May 2021 00:23:11 +0300 Subject: Make objective C use C standard version. Closes #5495. --- mesonbuild/compilers/objcpp.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'mesonbuild/compilers/objcpp.py') diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index 003da54..ad909f1 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -14,7 +14,8 @@ import typing as T -from ..mesonlib import MachineChoice +from .. import coredata +from ..mesonlib import MachineChoice, OptionKey from .mixins.clike import CLikeCompiler from .compilers import Compiler @@ -85,6 +86,24 @@ class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler): '3': default_warn_args + ['-Wextra', '-Wpedantic']} + def get_options(self) -> 'coredata.KeyedOptionDictType': + opts = super().get_options() + opts.update({ + OptionKey('std', machine=self.for_machine, lang='cpp'): coredata.UserComboOption( + 'C++ language standard to use', + ['none', 'c++98', 'c++11', 'c++14', 'c++17'], + 'none', + ) + }) + return opts + + def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]: + args = [] + std = options[OptionKey('std', machine=self.for_machine, lang='cpp')] + if std.value != 'none': + args.append('-std=' + std.value) + return args + class AppleClangObjCPPCompiler(ClangObjCPPCompiler): -- cgit v1.1