From 887e40034161589b63fdb14bfaee7f66374b9b83 Mon Sep 17 00:00:00 2001 From: Sebastian Holtermann Date: Wed, 15 Feb 2017 20:36:39 +0100 Subject: Autogen: Error message tweaks --- Source/cmQtAutoGenerators.cxx | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index e84b04d..859b2de 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -808,7 +808,12 @@ bool cmQtAutoGenerators::ParseContentForMoc( std::string fileToMoc; if (relaxed) { // Mode: Relaxed - if (!requiresMoc || (incBasename != scannedFileBasename)) { + if (requiresMoc && (incBasename == scannedFileBasename)) { + // Include self + fileToMoc = absFilename; + ownDotMocIncluded = true; + } else { + // In relaxed mode try to find a header instead but issue a warning const std::string headerToMoc = this->FindMatchingHeader( scannedFileAbsPath, incBasename, incSubDir); if (!headerToMoc.empty()) { @@ -817,11 +822,10 @@ bool cmQtAutoGenerators::ParseContentForMoc( if (!requiresMoc && (incBasename == scannedFileBasename)) { std::ostringstream err; err << "AutoMoc: Warning: " << absFilename << "\n" - << "The file includes the moc file \"" << incString - << "\", but does not contain a " << macroName - << " macro. Running moc on " - << "\"" << headerToMoc << "\" ! Include \"moc_" - << incBasename + << "The file includes the moc file \"" << incString << "\"" + << ", but does not contain a Q_OBJECT or Q_GADGET macro.\n" + << "Running moc on \"" << headerToMoc << "\"!\n" + << "Include \"moc_" << incBasename << ".cpp\" for a compatibility with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"; this->LogWarning(err.str()); @@ -829,10 +833,9 @@ bool cmQtAutoGenerators::ParseContentForMoc( std::ostringstream err; err << "AutoMoc: Warning: " << absFilename << "\n" << "The file includes the moc file \"" << incString - << "\" instead of \"moc_" << incBasename - << ".cpp\". Running moc on " - << "\"" << headerToMoc << "\" ! Include \"moc_" - << incBasename + << "\" instead of \"moc_" << incBasename << ".cpp\".\n" + << "Running moc on \"" << headerToMoc << "\"!\n" + << "Include \"moc_" << incBasename << ".cpp\" for compatibility with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"; this->LogWarning(err.str()); @@ -847,10 +850,6 @@ bool cmQtAutoGenerators::ParseContentForMoc( this->LogError(err.str()); return false; } - } else { - // Include self - fileToMoc = absFilename; - ownDotMocIncluded = true; } } else { // Mode: Strict @@ -892,9 +891,9 @@ bool cmQtAutoGenerators::ParseContentForMoc( << "The file contains a " << macroName << " macro, but does not include " << "\"" << scannedFileBasename << ".moc\", but instead includes " - << "\"" << ownMocUnderscoreFile << "\". Running moc on " - << "\"" << absFilename << "\" ! Better include \"" - << scannedFileBasename + << "\"" << ownMocUnderscoreFile << "\".\n" + << "Running moc on \"" << absFilename << "\"!\n" + << "Better include \"" << scannedFileBasename << ".moc\" for compatibility with " "strict mode (see CMAKE_AUTOMOC_RELAXED_MODE).\n"; this->LogWarning(err.str()); @@ -908,7 +907,7 @@ bool cmQtAutoGenerators::ParseContentForMoc( err << "AutoMoc: Error: " << absFilename << "\n" << "The file contains a " << macroName << " macro, but does not include " - << "\"" << scannedFileBasename << ".moc\" !\n"; + << "\"" << scannedFileBasename << ".moc\"!\n"; this->LogError(err.str()); return false; } -- cgit v0.12