From 40e27b14f1db25f36b48e21821a17143dbb3a066 Mon Sep 17 00:00:00 2001 From: Nomura Date: Mon, 15 May 2023 13:50:59 +0200 Subject: Metrowerks: move PCH args to the end of the command line --- mesonbuild/backend/ninjabackend.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index a3c0fa3..8a3f72c 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2854,10 +2854,16 @@ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485''')) # Include PCH header as first thing as it must be the first one or it will be # ignored by gcc https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100462 - if self.environment.coredata.options.get(OptionKey('b_pch')) and is_generated != 'pch': + use_pch = self.environment.coredata.options.get(OptionKey('b_pch')) and is_generated != 'pch' + if use_pch and 'mw' not in compiler.id: commands += self.get_pch_include_args(compiler, target) commands += self._generate_single_compile_target_args(target, compiler, is_generated) + + # Metrowerks compilers require PCH include args to come after intraprocedural analysis args + if use_pch and 'mw' in compiler.id: + commands += self.get_pch_include_args(compiler, target) + commands = commands.compiler.compiler_args(commands) # Create introspection information -- cgit v1.1