diff options
Diffstat (limited to 'mesonbuild/compilers/objcpp.py')
-rw-r--r-- | mesonbuild/compilers/objcpp.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/mesonbuild/compilers/objcpp.py b/mesonbuild/compilers/objcpp.py index 104d0cb..743bbb9 100644 --- a/mesonbuild/compilers/objcpp.py +++ b/mesonbuild/compilers/objcpp.py @@ -20,6 +20,7 @@ if T.TYPE_CHECKING: from ..environment import Environment from ..linkers.linkers import DynamicLinker from ..mesonlib import MachineChoice + from ..build import BuildTarget class ObjCPPCompiler(CLikeCompiler, Compiler): @@ -80,14 +81,18 @@ class GnuObjCPPCompiler(GnuCPPStds, GnuCompiler, ObjCPPCompiler): self.supported_warn_args(gnu_common_warning_args) + self.supported_warn_args(gnu_objc_warning_args))} - def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]: - args = [] - std = options.get_value(self.form_compileropt_key('std')) + def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]: + args: T.List[str] = [] + key = OptionKey('cpp_std', machine=self.for_machine) + if target: + std = env.coredata.get_option_for_target(target, key) + else: + std = env.coredata.get_option_for_subproject(key, subproject) + assert isinstance(std, str) if std != 'none': args.append('-std=' + std) return args - class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler): def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str, for_machine: MachineChoice, @@ -105,9 +110,11 @@ class ClangObjCPPCompiler(ClangCPPStds, ClangCompiler, ObjCPPCompiler): '3': default_warn_args + ['-Wextra', '-Wpedantic'], 'everything': ['-Weverything']} - def get_option_compile_args(self, options: 'coredata.KeyedOptionDictType') -> T.List[str]: + def get_option_compile_args(self, target: 'BuildTarget', env: 'Environment', subproject: T.Optional[str] = None) -> T.List[str]: args = [] - std = options.get_value(self.form_compileropt_key('std')) + key = OptionKey('cpp_std', machine=self.for_machine) + std = self.get_compileropt_value(key, env, target, subproject) + assert isinstance(std, str) if std != 'none': args.append('-std=' + std) return args |