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
This commit is contained in:
Evan Wilde
2024-01-11 20:24:36 -08:00
parent c6d69d84db
commit 9950a69f26

View File

@@ -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();