Autogen: New logCommand method. It prints commands using std::cout.

This commit is contained in:
Sebastian Holtermann 2016-04-18 12:02:28 +02:00 committed by Brad King
parent 95064a6d35
commit 8ced8bb95a
2 changed files with 25 additions and 21 deletions

View File

@ -1159,13 +1159,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
if (this->Verbose) if (this->Verbose)
{ {
for(std::vector<std::string>::const_iterator cmdIt = command.begin(); this->LogCommand(command);
cmdIt != command.end();
++cmdIt)
{
std::cout << *cmdIt << " ";
}
std::cout << std::endl;
} }
std::string output; std::string output;
@ -1231,13 +1225,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
if (this->Verbose) if (this->Verbose)
{ {
for(std::vector<std::string>::const_iterator cmdIt = command.begin(); this->LogCommand(command);
cmdIt != command.end();
++cmdIt)
{
std::cout << *cmdIt << " ";
}
std::cout << std::endl;
} }
std::string output; std::string output;
int retVal = 0; int retVal = 0;
@ -1322,13 +1310,7 @@ bool cmQtAutoGenerators::GenerateQrc()
if (this->Verbose) if (this->Verbose)
{ {
for(std::vector<std::string>::const_iterator cmdIt = command.begin(); this->LogCommand(command);
cmdIt != command.end();
++cmdIt)
{
std::cout << *cmdIt << " ";
}
std::cout << std::endl;
} }
std::string output; std::string output;
int retVal = 0; int retVal = 0;
@ -1347,6 +1329,27 @@ bool cmQtAutoGenerators::GenerateQrc()
return true; return true;
} }
void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command)
{
std::stringstream sbuf;
for(std::vector<std::string>::const_iterator cmdIt = command.begin();
cmdIt != command.end();
++cmdIt)
{
if ( cmdIt != command.begin() )
{
sbuf << " ";
}
sbuf << *cmdIt;
}
sbuf.flush();
if ( !sbuf.str().empty() )
{
std::cout << sbuf.str();
std::cout << std::endl;
}
}
std::string cmQtAutoGenerators::JoinExts(const std::vector<std::string>& lst) std::string cmQtAutoGenerators::JoinExts(const std::vector<std::string>& lst)
{ {
if (lst.empty()) if (lst.empty())

View File

@ -69,6 +69,7 @@ private:
void Init(); void Init();
void LogCommand(const std::vector<std::string>& command);
std::string JoinExts(const std::vector<std::string>& lst); std::string JoinExts(const std::vector<std::string>& lst);
static void MergeUicOptions(std::vector<std::string> &opts, static void MergeUicOptions(std::vector<std::string> &opts,