Makefile: Pass includes response file using native path style

We already pass the objects and libraries response files to the linker
this way.  In particular, this is needed when using `NMake Makefiles`
on Windows with a path to `clang++.exe` that is not a "short path":

    >nmake -f slash.make
    "C:\Program Files\LLVM\bin\clang++.exe" @CMakeFiles/slash.rsp
    cannot not open file 'C:\...\CMakeFiles': is a directory
    >nmake -f backslash.make
    "C:\Program Files\LLVM\bin\clang++.exe" @CMakeFiles\backslash.rsp
This commit is contained in:
Brad King
2026-02-24 10:51:07 -05:00
parent 728b8b34c2
commit c211b5b7f3
+6 -3
View File
@@ -2329,9 +2329,12 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags,
responseFlag = "@";
}
std::string const name = cmStrCat("includes_", lang, ".rsp");
std::string const arg = std::move(responseFlag) +
this->CreateResponseFile(name, includeFlags, this->FlagFileDepends[lang],
lang);
std::string const includes_rsp = this->CreateResponseFile(
name, includeFlags, this->FlagFileDepends[lang], lang);
std::string const arg =
cmStrCat(std::move(responseFlag),
this->LocalGenerator->ConvertToOutputFormat(
includes_rsp, cmOutputConverter::SHELL));
this->LocalGenerator->AppendFlags(flags, arg);
} else {
this->LocalGenerator->AppendFlags(flags, includeFlags);