summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Wilde <ewilde@apple.com>2024-01-12 04:24:36 (GMT)
committerEvan Wilde <ewilde@apple.com>2024-01-12 04:31:40 (GMT)
commit9950a69f269d3c661847836a6ad3e6a77450bed9 (patch)
tree09b735bf35f51771b6e1d8bba959b887bdb7742b
parentc6d69d84dbdf3e2db70e6272a95d977c2c685ee2 (diff)
downloadCMake-9950a69f269d3c661847836a6ad3e6a77450bed9.zip
CMake-9950a69f269d3c661847836a6ad3e6a77450bed9.tar.gz
CMake-9950a69f269d3c661847836a6ad3e6a77450bed9.tar.bz2
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
-rw-r--r--Source/cmNinjaTargetGenerator.cxx7
1 files 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();