From: Chun-wei Fan Date: Tue, 24 Oct 2023 06:54:19 +0000 (+0800) Subject: builds: Require -Zc:preprocessor for Visual Studio debug builds X-Git-Tag: archive/raspbian/4.12.4+ds-3+rpi1^2~21^2^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=287436a26dfda0647d551e45b1e8b27aa44062f6;p=gtk4.git builds: Require -Zc:preprocessor for Visual Studio debug builds This flag is actually required for the debugging code to successfully build, so check that it is really there for debug-enabled Visual Studio builds. --- diff --git a/meson.build b/meson.build index 55d8dcc2be..0c42d4cb3d 100644 --- a/meson.build +++ b/meson.build @@ -248,12 +248,23 @@ endif # Compiler flags if cc.get_id() == 'msvc' + required_cflags = [] + required_debug_cflags = '-Zc:preprocessor' test_cflags = [ '-FI@0@/build-aux/msvc/msvc_recommended_pragmas.h'.format(meson.project_source_root()), '-D_USE_MATH_DEFINES', - '-Zc:preprocessor' + required_debug_cflags ] - add_project_arguments(cc.get_supported_arguments(test_cflags), language: 'c') + msvc_supported_cflags = cc.get_supported_arguments(test_cflags) + if debug + required_cflags += required_debug_cflags + endif + foreach f : required_cflags + if not msvc_supported_cflags.contains(f) + error('@0@ required for this build'.format(f)) + endif + endforeach + add_project_arguments(msvc_supported_cflags, language: 'c') add_languages('cpp') cxx = meson.get_compiler('cpp')