From a186c1aff61fdedd2ef8d544c9f31c739daaa896 Mon Sep 17 00:00:00 2001 From: Kyle Edwards Date: Fri, 15 Jul 2022 15:29:20 -0400 Subject: Ninja Multi-Config: Deduplicate compile_commands.json for cross configs compile_commands.json was being written for every permutation of cross configurations. Deduplicate so only one command is output for each configuration. Fixes: #23733 --- Source/cmNinjaTargetGenerator.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Source/cmNinjaTargetGenerator.cxx') diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 86ae45db95..a4080d80df 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -1343,9 +1343,11 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatement( } } - this->ExportObjectCompileCommand( - language, sourceFilePath, objectDir, objectFileName, objectFileDir, - vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config); + if (firstForConfig) { + this->ExportObjectCompileCommand( + language, sourceFilePath, objectDir, objectFileName, objectFileDir, + vars["FLAGS"], vars["DEFINES"], vars["INCLUDES"], config); + } objBuild.Outputs.push_back(objectFileName); if (firstForConfig) { -- cgit v1.2.1