From 063b74ebba51133d5a79b86c984165c6709ad9d8 Mon Sep 17 00:00:00 2001 From: Elliot Haisley <35050275+Apache-HB@users.noreply.github.com> Date: Sat, 18 Jul 2020 15:34:24 -0400 Subject: fix msvc not recognising b_ndebug fixes #7404 --- mesonbuild/compilers/cpp.py | 2 +- test cases/windows/17 msvc ndebug/main.cpp | 9 +++++++++ test cases/windows/17 msvc ndebug/meson.build | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 test cases/windows/17 msvc ndebug/main.cpp create mode 100644 test cases/windows/17 msvc ndebug/meson.build diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 478a68c..f5b0c05 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -577,7 +577,7 @@ class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixi is_cross: bool, info: 'MachineInfo', exe_wrap, target, **kwargs): CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrap, **kwargs) MSVCCompiler.__init__(self, target) - self.base_options = ['b_pch', 'b_vscrt'] # FIXME add lto, pgo and the like + self.base_options = ['b_pch', 'b_vscrt', 'b_ndebug'] # FIXME add lto, pgo and the like self.id = 'msvc' def get_options(self): diff --git a/test cases/windows/17 msvc ndebug/main.cpp b/test cases/windows/17 msvc ndebug/main.cpp new file mode 100644 index 0000000..d647d71 --- /dev/null +++ b/test cases/windows/17 msvc ndebug/main.cpp @@ -0,0 +1,9 @@ +int main() { +#ifdef NDEBUG + // NDEBUG is defined + return 0; +#else + // NDEBUG is not defined + return 1; +#endif +} \ No newline at end of file diff --git a/test cases/windows/17 msvc ndebug/meson.build b/test cases/windows/17 msvc ndebug/meson.build new file mode 100644 index 0000000..78eaf89 --- /dev/null +++ b/test cases/windows/17 msvc ndebug/meson.build @@ -0,0 +1,7 @@ +project('msvc_ndebug', 'cpp', + default_options : [ 'b_ndebug=true' ] +) + +exe = executable('exe', 'main.cpp') + +test('ndebug', exe) -- cgit v1.1