summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutomoc.cxx
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-11-16 21:35:06 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-11-16 21:35:06 (GMT)
commit72bb058e92167a272b40b4b710fc2fe41b1fc8fe (patch)
treeb88e05e269cf41d6f247ca1105c6c098284e25f2 /Source/cmQtAutomoc.cxx
parente44ebd5f9b5eed18697dabbc4c1f570f60ded39c (diff)
downloadCMake-72bb058e92167a272b40b4b710fc2fe41b1fc8fe.zip
CMake-72bb058e92167a272b40b4b710fc2fe41b1fc8fe.tar.gz
CMake-72bb058e92167a272b40b4b710fc2fe41b1fc8fe.tar.bz2
Automoc: modified handling of included .moc files
-enable the KDE4-compatiblity mode only when using Qt4 -always (except in the KDE4 compat mode) error out if a cpp-file contains "Q_OBJECT", but does not include filename.moc Alex
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r--Source/cmQtAutomoc.cxx17
1 files changed, 14 insertions, 3 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 3d92a59..ad11668 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -652,13 +652,15 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (mocUnderscoreIncluded == true))
+ if ((dotMocIncluded == false) && (containsQ_OBJECT(contentsString)))
{
- if (containsQ_OBJECT(contentsString))
+ if ((this->QtMajorVersion == "4") && (mocUnderscoreIncluded == true))
{
+ // this is for KDE4 compatibility:
std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
<< "contains a Q_OBJECT macro, but does not include "
- << "\"" << scannedFileBasename << ".moc\", but instead includes "
+ << "\"" << scannedFileBasename << ".moc\", but instead "
+ "includes "
<< "\"" << ownMocUnderscoreFile << "\". Running moc on "
<< "\"" << absFilename << "\" ! Better include \""
<< scannedFileBasename << ".moc\" for a robust build."
@@ -666,6 +668,15 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
includedMocs[absFilename] = ownMocUnderscoreFile;
includedMocs.erase(ownMocHeaderFile);
}
+ else
+ {
+ // otherwise always error out since it will not compile:
+ std::cerr << "AUTOMOC: error: " << absFilename << ": The file "
+ << "contains a Q_OBJECT macro, but does not include "
+ << "\"" << scannedFileBasename << ".moc\" !"
+ << std::endl;
+ ::exit(EXIT_FAILURE);
+ }
}
// search for header files and private header files we may need to moc: