cmQtAutoGenerators: Split CR stripping out to helper function

This commit is contained in:
Brad King 2015-04-20 16:41:37 -04:00
parent b2289ff654
commit acd4f01fd8
1 changed files with 12 additions and 7 deletions

View File

@ -170,6 +170,17 @@ static std::string getAutogenTargetDir(cmTarget const* target)
return targetDir; 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, std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
cmTarget const* target, cmTarget const* target,
std::vector<std::string>& depends) std::vector<std::string>& depends)
@ -202,13 +213,7 @@ std::string cmQtAutoGenerators::ListQt5RccInputs(cmSourceFile* sf,
std::string oline; std::string oline;
while(std::getline(ostr, oline)) while(std::getline(ostr, oline))
{ {
// Strip CR characters rcc may have printed (possibly more than one!). oline = cmQtAutoGeneratorsStripCR(oline);
std::string::size_type cr = oline.find('\r');
if (cr != oline.npos)
{
oline = oline.substr(0, cr);
}
if (oline.empty()) if (oline.empty())
{ {
// The output of rcc --list contains many empty lines. // The output of rcc --list contains many empty lines.