summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerators.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-04-22 15:16:33 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-04-22 15:16:33 (GMT)
commitdf302bcc550e344f4cbe07f7941e1315dfd86ca5 (patch)
treee1b3f7d661817403541aaf71a787789dc24b810e /Source/cmQtAutoGenerators.cxx
parent6b229b48020987e71b35d84d43bcd4e73515d8b7 (diff)
parent258ba82882545d70162c865e56fc024ccd9cd164 (diff)
downloadCMake-df302bcc550e344f4cbe07f7941e1315dfd86ca5.zip
CMake-df302bcc550e344f4cbe07f7941e1315dfd86ca5.tar.gz
CMake-df302bcc550e344f4cbe07f7941e1315dfd86ca5.tar.bz2
Merge topic 'autogen-no-rcc-stderr'
258ba828 QtAutogen: Process 'rcc --list' stdout and stderr separately (#15523) acd4f01f cmQtAutoGenerators: Split CR stripping out to helper function
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r--Source/cmQtAutoGenerators.cxx61
1 files changed, 37 insertions, 24 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 1572dc1..1548c36 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -170,6 +170,17 @@ static std::string getAutogenTargetDir(cmTarget const* target)
return targetDir;
}
+static std::string cmQtAutoGeneratorsStripCR(std::string const& line)
+{
+ // Strip CR characters rcc may have printed (possibly more than one!).
+ std::string::size_type cr = line.find('\r');
+ if (cr != line.npos)
+ {
+ return line.substr(0, cr);
+ }
+ return line;
+}
+
std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
cmTarget const* target,
std::vector<std::string>& depends)
@@ -186,54 +197,56 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
command.push_back(absFile);
- std::string output;
+ std::string rccStdOut;
+ std::string rccStdErr;
int retVal = 0;
- bool result = cmSystemTools::RunSingleCommand(command, &output, &output,
- &retVal, 0,
- cmSystemTools::OUTPUT_NONE);
+ bool result = cmSystemTools::RunSingleCommand(
+ command, &rccStdOut, &rccStdErr,
+ &retVal, 0, cmSystemTools::OUTPUT_NONE);
if (!result || retVal)
{
std::cerr << "AUTOGEN: error: Rcc list process for " << sf->GetFullPath()
- << " failed:\n" << output << std::endl;
+ << " failed:\n" << rccStdOut << "\n" << rccStdErr << std::endl;
return std::string();
}
- std::istringstream ostr(output);
+ {
+ std::istringstream ostr(rccStdOut);
std::string oline;
while(std::getline(ostr, oline))
{
- // Strip CR characters rcc may have printed (possibly more than one!).
- std::string::size_type cr = oline.find('\r');
- if (cr != oline.npos)
+ oline = cmQtAutoGeneratorsStripCR(oline);
+ if(!oline.empty())
{
- oline = oline.substr(0, cr);
+ qrcEntries.push_back(oline);
}
+ }
+ }
- if (oline.empty())
- {
- // The output of rcc --list contains many empty lines.
- continue;
- }
- if (cmHasLiteralPrefix(oline, "RCC: Error in"))
+ {
+ std::istringstream estr(rccStdErr);
+ std::string eline;
+ while(std::getline(estr, eline))
+ {
+ eline = cmQtAutoGeneratorsStripCR(eline);
+ if (cmHasLiteralPrefix(eline, "RCC: Error in"))
{
static std::string searchString = "Cannot find file '";
- std::string::size_type pos = oline.find(searchString);
+ std::string::size_type pos = eline.find(searchString);
if (pos == std::string::npos)
{
std::cerr << "AUTOGEN: error: Rcc lists unparsable output "
- << oline << std::endl;
+ << eline << std::endl;
return std::string();
}
pos += searchString.length();
- std::string::size_type sz = oline.size() - pos - 1;
- qrcEntries.push_back(oline.substr(pos, sz));
- }
- else
- {
- qrcEntries.push_back(oline);
+ std::string::size_type sz = eline.size() - pos - 1;
+ qrcEntries.push_back(eline.substr(pos, sz));
}
}
+ }
+
depends.insert(depends.end(), qrcEntries.begin(), qrcEntries.end());
return cmJoin(qrcEntries, "@list_sep@");
}