summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorEvan Wilde <etceterawilde@gmail.com>2024-01-10 00:33:46 (GMT)
committerEvan Wilde <etceterawilde@gmail.com>2024-01-11 00:08:16 (GMT)
commitb767917ebb2130f097b7190713605cef481803fa (patch)
tree5958fad7ff7ba3a47af3d1e921dd3bea0c6c7d0d /Source/cmNinjaTargetGenerator.cxx
parent38234058ff68d3e28b8c4672033dd118127581be (diff)
downloadCMake-b767917ebb2130f097b7190713605cef481803fa.zip
CMake-b767917ebb2130f097b7190713605cef481803fa.tar.gz
CMake-b767917ebb2130f097b7190713605cef481803fa.tar.bz2
Swift/Ninja: Include sources in response file
Unlike C/C++, Swift compiles all sources in a module at once. This can quickly overwhelm the commandline length limit on Windows, so it is useful to place the source files in the response file. Issue: #25572
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index c493778..24e3e58 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -848,6 +848,14 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang,
flags = cmStrCat(responseFlag, rule.RspFile);
vars.Defines = "";
vars.Includes = "";
+
+ // Swift consumes all source files in a module at once, which reaches
+ // command line length limits pretty quickly. Inject source files into the
+ // response file in this case as well.
+ if (lang == "Swift") {
+ rule.RspContent = cmStrCat(rule.RspContent, ' ', vars.Source);
+ vars.Source = "";
+ }
}
// Tell ninja dependency format so all deps can be loaded into a database
@@ -1925,8 +1933,6 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
// For that, we need the "NEW" behavior for CMP0157. Otherwise, we have to
// fall back on the old "linker" build. Otherwise, this should be
// indistinguishable from the old behavior.
- //
- // FIXME(#25490): Add response file support to Swift object build step
if (sources.empty()) {
return;