From 2579420a72b64c020f9538d8ccbb52fd57c804a1 Mon Sep 17 00:00:00 2001 From: Olexa Bilaniuk Date: Fri, 12 Mar 2021 18:09:22 -0500 Subject: Strip host-compiler -std flag from NVCC line. Closes #8523. --- mesonbuild/compilers/cuda.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'mesonbuild/compilers') diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py index 0ef92b5..145b7c8 100644 --- a/mesonbuild/compilers/cuda.py +++ b/mesonbuild/compilers/cuda.py @@ -617,8 +617,19 @@ class CudaCompiler(Compiler): return opts def _to_host_compiler_options(self, options: 'KeyedOptionDictType') -> 'KeyedOptionDictType': + """ + Convert an NVCC Option set to a host compiler's option set. + """ + + # We must strip the -std option from the host compiler option set, as NVCC has + # its own -std flag that may not agree with the host compiler's. overrides = {name: opt.value for name, opt in options.items()} - return OptionOverrideProxy(overrides, self.host_compiler.get_options()) + overrides.pop(OptionKey('std', machine=self.for_machine, + lang=self.host_compiler.language), None) + host_options = self.host_compiler.get_options().copy() + if 'std' in host_options: + del host_options['std'] # type: ignore + return OptionOverrideProxy(overrides, host_options) def get_option_compile_args(self, options: 'KeyedOptionDictType') -> T.List[str]: args = self.get_ccbin_args(options) -- cgit v1.1