summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-11-10 19:25:28 (GMT)
committerAlex Neundorf <neundorf@kde.org>2011-11-10 21:11:32 (GMT)
commitd08bc32bc29078764fc44fd3809eeda527e7017f (patch)
treee8b841cefeee10a7e2ccac4ae58b8731e1e7b17b
parentfce8e81895454c31273921baec2cc6acd9e962a9 (diff)
downloadCMake-d08bc32bc29078764fc44fd3809eeda527e7017f.zip
CMake-d08bc32bc29078764fc44fd3809eeda527e7017f.tar.gz
CMake-d08bc32bc29078764fc44fd3809eeda527e7017f.tar.bz2
automoc: stricter checking for what file is included
foo.cpp must include foo.moc to have itself processed by moc Alex
-rw-r--r--Source/cmQtAutomoc.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index a839489..15a034c 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -517,6 +517,8 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
}
const std::string absPath = cmsys::SystemTools::GetFilenamePath(
cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+ const std::string scannedFileBasename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFilename);
std::string::size_type matchOffset = 0;
if (mocIncludeRegExp.find(contentsString.c_str()))
@@ -605,6 +607,16 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
}
else
{
+ if (basename != scannedFileBasename)
+ {
+ std::cerr << "AUTOMOC: The file \"" << absFilename
+ << "\" 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;
}
matchOffset += mocIncludeRegExp.end();