diff options
author | Alex Neundorf <neundorf@kde.org> | 2011-11-22 21:01:13 (GMT) |
---|---|---|
committer | Alex Neundorf <neundorf@kde.org> | 2011-11-22 21:01:13 (GMT) |
commit | bde4edb6ab6501de42bdc167e027a9f5c5760244 (patch) | |
tree | 0059ae69093206f7b94db2cdd6bbf0d2a64be54f /Source/cmQtAutomoc.cxx | |
parent | 74ab0f6aa409a9d3e90c91b1b1c7a6e4b865ed62 (diff) | |
download | CMake-bde4edb6ab6501de42bdc167e027a9f5c5760244.zip CMake-bde4edb6ab6501de42bdc167e027a9f5c5760244.tar.gz CMake-bde4edb6ab6501de42bdc167e027a9f5c5760244.tar.bz2 |
automoc: add special handling for including basename_p.moc, with test
Alex
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index 931cc5d..9cb8f63 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -650,13 +650,38 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename, { if (basename != scannedFileBasename) { - std::cerr << "AUTOMOC: error: " << absFilename << ": The file " - << "includes the moc file \"" << currentMoc - << "\", which seems to be the moc file from a different " - << "source file. This is not supported. " - << "Include \"" << scannedFileBasename << ".moc\" to run " - << "moc on this source file." << std::endl; - ::exit(EXIT_FAILURE); + bool fail = true; + if ((this->QtMajorVersion == "4") + && (basename == scannedFileBasename +"_p")) + { + std::string mocSubDir = extractSubDir(absPath, currentMoc); + std::string headerToMoc = findMatchingHeader( + absPath, mocSubDir, basename, headerExtensions); + if (!headerToMoc.empty()) + { + // this is for KDE4 compatibility: + fail = false; + includedMocs[headerToMoc] = currentMoc; + std::cerr << "AUTOMOC: warning: " << absFilename << ": The file " + "includes the moc file \"" << currentMoc << + "\" instead of \"moc_" << basename << ".cpp\". " + "Running moc on " + << "\"" << headerToMoc << "\" ! Better include \"moc_" + << basename << ".cpp\" for a robust build." + << std::endl; + } + } + + if (fail) + { + std::cerr <<"AUTOMOC: error: " << absFilename << ": The file " + "includes the moc file \"" << currentMoc << + "\", which seems to be the moc file from a different " + "source file. This is not supported. " + "Include \"" << scannedFileBasename << ".moc\" to run " + "moc on this source file." << std::endl; + ::exit(EXIT_FAILURE); + } } includedMocs[absFilename] = currentMoc; dotMocIncluded = true; |