diff options
author | Michael Hirsch <scivision@users.noreply.github.com> | 2020-08-05 22:56:19 -0400 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-08-09 11:48:41 -0700 |
commit | f2890cbf9746ed76b113d32dffebdc9ade202a59 (patch) | |
tree | 1a29f47107cdcf1aa15719beb7910ce5efc74b3d /mesonbuild/compilers/c.py | |
parent | a98db022aa4cc0798fba4bb2f723e5b0cc3b2570 (diff) | |
download | meson-f2890cbf9746ed76b113d32dffebdc9ade202a59.zip meson-f2890cbf9746ed76b113d32dffebdc9ade202a59.tar.gz meson-f2890cbf9746ed76b113d32dffebdc9ade202a59.tar.bz2 |
msvc: enable /std:c11 flag
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r-- | mesonbuild/compilers/c.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index aac99b4..95851be 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -353,6 +353,26 @@ class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompi info, exe_wrap, **kwargs) MSVCCompiler.__init__(self, target) + def get_options(self): + opts = super().get_options() + c_stds = ['none', 'c89', 'c99', 'c11'] + opts.update({ + 'std': coredata.UserComboOption( + 'C language standard to use', + c_stds, + 'none', + ), + }) + return opts + + def get_option_compile_args(self, options): + args = [] + std = options['std'] + # As of MVSC 16.7, /std:c11 is the only valid C standard option. + if std.value in {'c11'}: + args.append('/std:' + std.value) + return args + class ClangClCCompiler(ClangClCompiler, VisualStudioLikeCCompilerMixin, CCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, |