From 468022f91c3c9eb5b98ac5c62928afac9b9139b2 Mon Sep 17 00:00:00 2001 From: Christian Wendt Date: Tue, 7 Jun 2022 11:23:51 +0200 Subject: backends: Remove /Zi arg if requested to use /Z7 Change the order of testing flags and get_external_args() to handle flags set by get_external_args() correctly. --- mesonbuild/backend/backends.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index c3c44e6..1505206 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -952,15 +952,15 @@ class Backend: # Add compile args added using add_global_arguments() # These override per-project arguments commands += self.build.get_global_args(compiler, target.for_machine) - # Using both /ZI and /Zi at the same times produces a compiler warning. - # We do not add /ZI by default. If it is being used it is because the user has explicitly enabled it. - # /ZI needs to be removed in that case to avoid cl's warning to that effect (D9025 : overriding '/ZI' with '/Zi') - if ('/ZI' in commands) and ('/Zi' in commands): - commands.remove('/Zi') # Compile args added from the env: CFLAGS/CXXFLAGS, etc, or the cross # file. We want these to override all the defaults, but not the # per-target compile args. commands += self.environment.coredata.get_external_args(target.for_machine, compiler.get_language()) + # Using both /Z7 or /ZI and /Zi at the same times produces a compiler warning. + # We do not add /Z7 or /ZI by default. If it is being used it is because the user has explicitly enabled it. + # /Zi needs to be removed in that case to avoid cl's warning to that effect (D9025 : overriding '/Zi' with '/ZI') + if ('/Zi' in commands) and (('/ZI' in commands) or ('/Z7' in commands)): + commands.remove('/Zi') # Always set -fPIC for shared libraries if isinstance(target, build.SharedLibrary): commands += compiler.get_pic_args() -- cgit v1.1