diff options
Diffstat (limited to 'mesonbuild/compilers/cpp.py')
-rw-r--r-- | mesonbuild/compilers/cpp.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 6566587..b37f8cd 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -718,6 +718,12 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi info, exe_wrapper, linker=linker, full_version=full_version) MSVCCompiler.__init__(self, target) + # By default, MSVC has a broken __cplusplus define that pretends to be c++98: + # https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160 + # Pass the flag to enable a truthful define, if possible. + if version_compare(self.version, '>= 19.14.26428'): + self.always_args = self.always_args + ['/Zc:__cplusplus'] + def get_options(self) -> 'MutableKeyedOptionDictType': cpp_stds = ['none', 'c++11', 'vc++11'] # Visual Studio 2015 and later @@ -747,16 +753,6 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi del args[i] return args - def get_always_args(self) -> T.List[str]: - args = super().get_always_args() - - # By default, MSVC has a broken __cplusplus define that pretends to be c++98: - # https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus?view=msvc-160 - # Pass the flag to enable a truthful define, if possible. - if version_compare(self.version, '>= 19.14.26428') and '/Zc:__cplusplus' not in args: - return args + ['/Zc:__cplusplus'] - return args - class ClangClCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixin, ClangClCompiler, CPPCompiler): id = 'clang-cl' |