diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-11-30 19:47:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-12-07 13:23:57 (GMT) |
commit | 708e44af5d445d25cc39e83da800ccc57f90a79a (patch) | |
tree | b6b3580ef8f41da24c616cc84edf35d343976026 /Source | |
parent | 1c97d1df20bbf771568321020e84718b82788272 (diff) | |
download | CMake-708e44af5d445d25cc39e83da800ccc57f90a79a.zip CMake-708e44af5d445d25cc39e83da800ccc57f90a79a.tar.gz CMake-708e44af5d445d25cc39e83da800ccc57f90a79a.tar.bz2 |
QtAutogen: Improved error recognition
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 90 |
1 files changed, 48 insertions, 42 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index eea9804..a0302cb 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -549,32 +549,19 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile) this->ParseHeaders(headerFiles, includedMocs, notIncludedMocs, includedUis); if (!this->MocExecutable.empty()) { - this->GenerateMocFiles(includedMocs, notIncludedMocs); + if (!this->GenerateMocFiles(includedMocs, notIncludedMocs)) { + return false; + } } if (!this->UicExecutable.empty()) { - this->GenerateUiFiles(includedUis); + if (!this->GenerateUiFiles(includedUis)) { + return false; + } } if (!this->RccExecutable.empty()) { - this->GenerateQrcFiles(); - } - - if (this->RunMocFailed) { - std::ostringstream err; - err << "moc failed..." << std::endl; - this->LogError(err.str()); - return false; - } - if (this->RunUicFailed) { - std::ostringstream err; - err << "uic failed..." << std::endl; - this->LogError(err.str()); - return false; - } - if (this->RunRccFailed) { - std::ostringstream err; - err << "rcc failed..." << std::endl; - this->LogError(err.str()); - return false; + if (!this->GenerateQrcFiles()) { + return false; + } } return true; @@ -1011,7 +998,7 @@ bool cmQtAutoGenerators::GenerateMocFiles( << "- rename the source files or" << std::endl << "- do not include the (moc_NAME.cpp|NAME.moc) file" << std::endl; this->NameCollisionLog(err.str(), collisions); - ::exit(EXIT_FAILURE); + return false; } } @@ -1092,6 +1079,9 @@ bool cmQtAutoGenerators::GenerateMocFiles( return true; } +/** + * @return True if a moc file was created. False may indicate an error. + */ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, const std::string& mocFileName) { @@ -1136,12 +1126,16 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile, bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); if (!result || retVal) { - std::ostringstream err; - err << "AUTOGEN: error: process for " << mocFilePath << " failed:\n" - << output << std::endl; - this->LogError(err.str()); - this->RunMocFailed = true; + { + std::ostringstream err; + err << "AUTOGEN: error: moc process for " << mocFilePath + << " failed:\n" + << output << std::endl; + this->LogError(err.str()); + } cmSystemTools::RemoveFile(mocFilePath); + this->RunMocFailed = true; + return false; } return true; } @@ -1183,7 +1177,7 @@ bool cmQtAutoGenerators::GenerateUiFiles( << std::endl << "To avoid this error rename the source files." << std::endl; this->NameCollisionLog(err.str(), collisions); - ::exit(EXIT_FAILURE); + return false; } } testMap.clear(); @@ -1207,6 +1201,9 @@ bool cmQtAutoGenerators::GenerateUiFiles( return true; } +/** + * @return True if a uic file was created. False may indicate an error. + */ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, const std::string& uiInputFile, const std::string& uiOutputFile) @@ -1253,13 +1250,15 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName, bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); if (!result || retVal) { - std::ostringstream err; - err << "AUTOUIC: error: process for " << uiOutputFile - << " needed by\n \"" << realName << "\"\nfailed:\n" - << output << std::endl; - this->LogError(err.str()); - this->RunUicFailed = true; + { + std::ostringstream err; + err << "AUTOUIC: error: uic process for " << uiOutputFile + << " needed by\n \"" << realName << "\"\nfailed:\n" + << output << std::endl; + this->LogError(err.str()); + } cmSystemTools::RemoveFile(uiOutputFile); + this->RunUicFailed = true; return false; } return true; @@ -1312,7 +1311,7 @@ bool cmQtAutoGenerators::GenerateQrcFiles() << std::endl << "To avoid this error rename the source .qrc files." << std::endl; this->NameCollisionLog(err.str(), collisions); - ::exit(EXIT_FAILURE); + return false; } } @@ -1330,6 +1329,9 @@ bool cmQtAutoGenerators::GenerateQrcFiles() return true; } +/** + * @return True if a rcc file was created. False may indicate an error. + */ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile, const std::string& qrcOutputFile, bool unique_n) @@ -1387,16 +1389,20 @@ bool cmQtAutoGenerators::GenerateQrc(const std::string& qrcInputFile, bool result = cmSystemTools::RunSingleCommand(command, &output, &output, &retVal); if (!result || retVal) { - std::ostringstream err; - err << "AUTORCC: error: process for " << qrcOutputFile << " failed:\n" - << output << std::endl; - this->LogError(err.str()); - this->RunRccFailed = true; + { + std::ostringstream err; + err << "AUTORCC: error: rcc process for " << qrcOutputFile + << " failed:\n" + << output << std::endl; + this->LogError(err.str()); + } cmSystemTools::RemoveFile(qrcBuildFile); + this->RunRccFailed = true; return false; } + return true; } - return true; + return false; } /** |