diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-11-30 20:08:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-07 13:23:58 (GMT) |
commit | 00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3 (patch) | |
tree | 67dba558cad429b5bed657ed4912b22aed63fcd1 /Source | |
parent | 708e44af5d445d25cc39e83da800ccc57f90a79a (diff) | |
download | CMake-00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3.zip CMake-00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3.tar.gz CMake-00750ece6a5dbfd51a8dd789c4d7dc1246f63ec3.tar.bz2 |
QtAutogen: Error and warning log method tweaks
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 36 | ||||
-rw-r--r-- | Source/cmQtAutoGenerators.h | 6 |
2 files changed, 27 insertions, 15 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index a0302cb..a6099fa 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -8,6 +8,7 @@ #include <cmsys/FStream.hxx> #include <cmsys/RegularExpression.hxx> #include <cmsys/Terminal.h> +#include <iostream> #include <sstream> #include <stdlib.h> #include <string.h> @@ -195,7 +196,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile( if (!makefile->ReadListFile(filename.c_str())) { std::ostringstream err; - err << "AUTOGEN: Error processing file: " << filename << std::endl; + err << "AUTOGEN: error processing file: " << filename << std::endl; this->LogError(err.str()); return false; } @@ -582,7 +583,7 @@ void cmQtAutoGenerators::ParseCppFile( std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; - this->LogError(err.str()); + this->LogWarning(err.str()); return; } this->ParseForUic(absFilename, contentsString, includedUis); @@ -673,7 +674,7 @@ void cmQtAutoGenerators::ParseCppFile( << ".cpp\" for a compatibility with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" << std::endl; - this->LogError(err.str()); + this->LogWarning(err.str()); } else { std::ostringstream err; err << "AUTOGEN: warning: " << absFilename @@ -686,7 +687,7 @@ void cmQtAutoGenerators::ParseCppFile( << ".cpp\" for compatibility with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" << std::endl; - this->LogError(err.str()); + this->LogWarning(err.str()); } } else { std::ostringstream err; @@ -730,7 +731,7 @@ void cmQtAutoGenerators::ParseCppFile( << ".moc\" for compatibility with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n" << std::endl; - this->LogError(err.str()); + this->LogWarning(err.str()); includedMocs[absFilename] = ownMocUnderscoreFile; includedMocs.erase(ownMocHeaderFile); @@ -764,7 +765,7 @@ void cmQtAutoGenerators::StrictParseCppFile( std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; - this->LogError(err.str()); + this->LogWarning(err.str()); return; } this->ParseForUic(absFilename, contentsString, includedUis); @@ -876,7 +877,7 @@ void cmQtAutoGenerators::ParseForUic( std::ostringstream err; err << "AUTOGEN: warning: " << absFilename << ": file is empty\n" << std::endl; - this->LogError(err.str()); + this->LogWarning(err.str()); return; } this->ParseForUic(absFilename, contentsString, includedUis); @@ -997,7 +998,7 @@ bool cmQtAutoGenerators::GenerateMocFiles( << "To avoid this error either" << std::endl << "- rename the source files or" << std::endl << "- do not include the (moc_NAME.cpp|NAME.moc) file" << std::endl; - this->NameCollisionLog(err.str(), collisions); + this->LogErrorNameCollision(err.str(), collisions); return false; } } @@ -1176,7 +1177,7 @@ bool cmQtAutoGenerators::GenerateUiFiles( "from different sources." << std::endl << "To avoid this error rename the source files." << std::endl; - this->NameCollisionLog(err.str(), collisions); + this->LogErrorNameCollision(err.str(), collisions); return false; } } @@ -1310,7 +1311,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles() " will be generated from different sources." << std::endl << "To avoid this error rename the source .qrc files." << std::endl; - this->NameCollisionLog(err.str(), collisions); + this->LogErrorNameCollision(err.str(), collisions); return false; } } @@ -1435,7 +1436,7 @@ bool cmQtAutoGenerators::NameCollisionTest( return !collisions.empty(); } -void cmQtAutoGenerators::NameCollisionLog( +void cmQtAutoGenerators::LogErrorNameCollision( const std::string& message, const std::multimap<std::string, std::string>& collisions) { @@ -1453,12 +1454,21 @@ void cmQtAutoGenerators::NameCollisionLog( void cmQtAutoGenerators::LogInfo(const std::string& message) { - cmSystemTools::Message(message.c_str()); + std::cout << message.c_str(); +} + +void cmQtAutoGenerators::LogWarning(const std::string& message) +{ + std::ostringstream ostr; + ostr << message << "\n"; + std::cout << message.c_str(); } void cmQtAutoGenerators::LogError(const std::string& message) { - cmSystemTools::Error(message.c_str()); + std::ostringstream ostr; + ostr << message << "\n\n"; + std::cerr << ostr.str(); } void cmQtAutoGenerators::LogCommand(const std::vector<std::string>& command) diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h index 47f3289..816c380 100644 --- a/Source/cmQtAutoGenerators.h +++ b/Source/cmQtAutoGenerators.h @@ -76,13 +76,15 @@ private: bool NameCollisionTest(const std::map<std::string, std::string>& genFiles, std::multimap<std::string, std::string>& collisions); - void NameCollisionLog( + + void LogErrorNameCollision( const std::string& message, const std::multimap<std::string, std::string>& collisions); - void LogInfo(const std::string& message); + void LogWarning(const std::string& message); void LogError(const std::string& message); 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, |