summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2016-04-18 12:02:28 +0200
committerBrad King <brad.king@kitware.com>2016-04-19 12:49:22 -0400
commit8ced8bb95aee78ece751259f9cce23786fe4a1b2 (patch)
tree46b18321be6af67d1b2c933515a1bf2c6934b18e
parent95064a6d35c93557c9bb87bc8eeff8555d7295a2 (diff)
downloadcmake-8ced8bb95aee78ece751259f9cce23786fe4a1b2.tar.gz
Autogen: New logCommand method. It prints commands using std::cout.
-rw-r--r--Source/cmQtAutoGenerators.cxx45
-rw-r--r--Source/cmQtAutoGenerators.h1
2 files changed, 25 insertions, 21 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 19f6a383df..65892fe0e7 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1159,13 +1159,7 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
if (this->Verbose)
{
- for(std::vector<std::string>::const_iterator cmdIt = command.begin();
- cmdIt != command.end();
- ++cmdIt)
- {
- std::cout << *cmdIt << " ";
- }
- std::cout << std::endl;
+ this->LogCommand(command);
}
std::string output;
@@ -1231,13 +1225,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
if (this->Verbose)
{
- for(std::vector<std::string>::const_iterator cmdIt = command.begin();
- cmdIt != command.end();
- ++cmdIt)
- {
- std::cout << *cmdIt << " ";
- }
- std::cout << std::endl;
+ this->LogCommand(command);
}
std::string output;
int retVal = 0;
@@ -1322,13 +1310,7 @@ bool cmQtAutoGenerators::GenerateQrc()
if (this->Verbose)
{
- for(std::vector<std::string>::const_iterator cmdIt = command.begin();
- cmdIt != command.end();
- ++cmdIt)
- {
- std::cout << *cmdIt << " ";
- }
- std::cout << std::endl;
+ this->LogCommand(command);
}
std::string output;
int retVal = 0;
@@ -1347,6 +1329,27 @@ bool cmQtAutoGenerators::GenerateQrc()
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)
{
if (lst.empty())
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index f9dd41c8e8..408ca14c4b 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -69,6 +69,7 @@ private:
void Init();
+ void LogCommand(const std::vector<std::string>& command);
std::string JoinExts(const std::vector<std::string>& lst);
static void MergeUicOptions(std::vector<std::string> &opts,