automoc: also accept other files when .moc is included in non-strict mode

Alex
This commit is contained in:
Alex Neundorf 2011-12-02 21:43:15 +01:00
parent 9c0df72dc4
commit c207f5d361
1 changed files with 14 additions and 20 deletions

View File

@ -675,28 +675,22 @@ void cmQtAutomoc::ParseCppFile(const std::string& absFilename,
std::string fileToMoc = absFilename; std::string fileToMoc = absFilename;
if (basename != scannedFileBasename) if (basename != scannedFileBasename)
{ {
bool fail = true; std::string mocSubDir = extractSubDir(absPath, currentMoc);
if (basename == scannedFileBasename+"_p") std::string headerToMoc = findMatchingHeader(
absPath, mocSubDir, basename, headerExtensions);
if (!headerToMoc.empty())
{ {
std::string mocSubDir = extractSubDir(absPath, currentMoc); // this is for KDE4 compatibility:
std::string headerToMoc = findMatchingHeader( fileToMoc = headerToMoc;
absPath, mocSubDir, basename, headerExtensions); std::cerr << "AUTOMOC: warning: " << absFilename << ": The file "
if (!headerToMoc.empty()) "includes the moc file \"" << currentMoc <<
{ "\" instead of \"moc_" << basename << ".cpp\". "
// this is for KDE4 compatibility: "Running moc on "
fail = false; << "\"" << headerToMoc << "\" ! Better include \"moc_"
fileToMoc = headerToMoc; << basename << ".cpp\" for a robust build.\n"
std::cerr << "AUTOMOC: warning: " << absFilename << ": The file " << std::endl;
"includes the moc file \"" << currentMoc <<
"\" instead of \"moc_" << basename << ".cpp\". "
"Running moc on "
<< "\"" << headerToMoc << "\" ! Better include \"moc_"
<< basename << ".cpp\" for a robust build.\n"
<< std::endl;
}
} }
else
if (fail)
{ {
std::cerr <<"AUTOMOC: error: " << absFilename << ": The file " std::cerr <<"AUTOMOC: error: " << absFilename << ": The file "
"includes the moc file \"" << currentMoc << "includes the moc file \"" << currentMoc <<