From 9950a69f269d3c661847836a6ad3e6a77450bed9 Mon Sep 17 00:00:00 2001 From: Evan Wilde Date: Thu, 11 Jan 2024 20:24:36 -0800 Subject: Swift/Ninja: Fix compile commands output file path The exported compile commands did not use the proper file path separator for Windows in the output field for Swift files. This patch adds the appropriate filepath fix-ups to the output-field. Fixes: #25580 --- Source/cmNinjaTargetGenerator.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index bc97e88..0ff1cb7 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -2356,6 +2356,8 @@ void cmNinjaTargetGenerator::ExportSwiftObjectCompileCommand( return this->LocalGenerator->ConvertToOutputFormat( srcFilename, cmOutputConverter::SHELL); }; + auto escapedModuleObjectFilename = + this->ConvertToNinjaPath(moduleObjectFilename); cmRulePlaceholderExpander::RuleVariables compileObjectVars; compileObjectVars.Language = "Swift"; @@ -2384,11 +2386,12 @@ void cmNinjaTargetGenerator::ExportSwiftObjectCompileCommand( for (cmSourceFile const* sf : moduleSourceFiles) { std::string const sourceFilename = this->GetCompiledSourceNinjaPath(sf); - std::string objectFilename = moduleObjectFilename; + std::string objectFilename = escapedModuleObjectFilename; if (!singleOutput) { // If it's not single-output, each source file gets a separate object - objectFilename = this->GetObjectFilePath(sf, outputConfig); + objectFilename = + this->ConvertToNinjaPath(this->GetObjectFilePath(sf, outputConfig)); } compileObjectVars.Objects = objectFilename.c_str(); -- cgit v0.12