summaryrefslogtreecommitdiff
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-25 13:41:14 +0000
committerKitware Robot <kwrobot@kitware.com>2017-04-25 09:41:18 -0400
commit74672e2ffaaa7f6c0efa1884a3f8d239d36ec7bf (patch)
treea26d41e0d84ac2b705ebf486efae21bae05efe12 /Source/cmNinjaTargetGenerator.cxx
parent7dca104e14519be4ff28978a1553a3395ecaf6d2 (diff)
parent594d3d6fffac33062629bafb819a5df7c1326824 (diff)
downloadcmake-74672e2ffaaa7f6c0efa1884a3f8d239d36ec7bf.tar.gz
Merge topic 'ninja-dyndep-response-file'
594d3d6f Ninja: support response file for cmake_ninja_depends on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !722
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx19
1 files changed, 15 insertions, 4 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index e0b2217b78..7e29681d60 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -557,13 +557,26 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
// Write the rule for ninja dyndep file generation.
std::vector<std::string> ddCmds;
+#ifdef _WIN32
+ // Windows command line length is limited -> use response file for dyndep
+ // rules
+ std::string ddRspFile = "$out.rsp";
+ std::string ddRspContent = "$in";
+ std::string ddInput = "@" + ddRspFile;
+#else
+ std::string ddRspFile;
+ std::string ddRspContent;
+ std::string ddInput = "$in";
+#endif
+
// Run CMake dependency scanner on preprocessed output.
std::string const cmake = this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmLocalGenerator::SHELL);
ddCmds.push_back(cmake + " -E cmake_ninja_dyndep"
" --tdi=" +
tdi + " --dd=$out"
- " $in");
+ " " +
+ ddInput);
std::string const ddCmdLine =
this->GetLocalGenerator()->BuildCommandLine(ddCmds);
@@ -575,9 +588,7 @@ void cmNinjaTargetGenerator::WriteCompileRule(const std::string& lang)
this->GetGlobalGenerator()->AddRule(
this->LanguageDyndepRule(lang), ddCmdLine, ddDesc.str(), ddComment.str(),
/*depfile*/ "",
- /*deps*/ "",
- /*rspfile*/ "",
- /*rspcontent*/ "",
+ /*deps*/ "", ddRspFile, ddRspContent,
/*restat*/ "",
/*generator*/ false);
}