diff options
author | Bernhard Burgermeister <bburgerm@googlemail.com> | 2017-02-07 15:50:47 (GMT) |
---|---|---|
committer | Bernhard Burgermeister <bburgerm@googlemail.com> | 2017-04-25 07:32:50 (GMT) |
commit | 594d3d6fffac33062629bafb819a5df7c1326824 (patch) | |
tree | 33f63d977929a8d07464639534815633e1074fed /Source/cmSystemTools.cxx | |
parent | 8b0016ab658e2b96211c33055b8cf38b6d4a6d94 (diff) | |
download | CMake-594d3d6fffac33062629bafb819a5df7c1326824.zip CMake-594d3d6fffac33062629bafb819a5df7c1326824.tar.gz CMake-594d3d6fffac33062629bafb819a5df7c1326824.tar.bz2 |
Ninja: support response file for cmake_ninja_depends on Windows
The internal tool "cmake_ninja_depends" now supports reading the list of ddi
files from a reponse file to circumvent Windows command line length limits.
Use this response file for dyndep rule on Windows.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 39625ae..42aae77 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -505,6 +505,39 @@ void cmSystemTools::ParseUnixCommandLine(const char* command, argv.Store(args); } +std::vector<std::string> cmSystemTools::HandleResponseFile( + std::vector<std::string>::const_iterator argBeg, + std::vector<std::string>::const_iterator argEnd) +{ + std::vector<std::string> arg_full; + for (std::vector<std::string>::const_iterator a = argBeg; a != argEnd; ++a) { + std::string const& arg = *a; + if (cmHasLiteralPrefix(arg, "@")) { + cmsys::ifstream responseFile(arg.substr(1).c_str(), std::ios::in); + if (!responseFile) { + std::string error = "failed to open for reading ("; + error += cmSystemTools::GetLastSystemError(); + error += "):\n "; + error += arg.substr(1); + cmSystemTools::Error(error.c_str()); + } else { + std::string line; + cmSystemTools::GetLineFromStream(responseFile, line); + std::vector<std::string> args2; +#ifdef _WIN32 + cmSystemTools::ParseWindowsCommandLine(line.c_str(), args2); +#else + cmSystemTools::ParseUnixCommandLine(line.c_str(), args2); +#endif + arg_full.insert(arg_full.end(), args2.begin(), args2.end()); + } + } else { + arg_full.push_back(arg); + } + } + return arg_full; +} + std::vector<std::string> cmSystemTools::ParseArguments(const char* command) { std::vector<std::string> args; |