Hi List,
I'm working on a KDE-ization of SpeedCrunch (a handy calculator program)
and discovered that Automoc doesn't like its .hxx headers. As it
scans .cpp, .cc, .cxx and .C files for moc includes, I think that being
able to use .hh, .hxx and .H files in addition to .h for the headers
would be quite logical. I prepared a patch for
kdelibs/cmake/automoc/kde4automoc.cpp and attached it to this mail.
Should I commit?
Regards,
Loïc
Index: cmake/automoc/kde4automoc.cpp
===================================================================
--- cmake/automoc/kde4automoc.cpp (révision 747144)
+++ cmake/automoc/kde4automoc.cpp (copie de travail)
@@ -138,6 +138,8 @@ bool AutoMoc::run()
QRegExp mocIncludeRegExp("[\n]\\s*#\\s*include\\s+[\"<](moc_[^ \">]+\\.cpp|[^ \">]+\\.moc)[\">]");
QRegExp qObjectRegExp("[\n]\\s*Q_OBJECT\\b");
+ QStringList headerExtensions;
+ headerExtensions << ".h" << ".hpp" << ".hxx" << ".H";
foreach (const QString &absFilename, sourceFiles) {
//qDebug() << absFilename;
const QFileInfo sourceFileInfo(absFilename);
@@ -193,15 +195,23 @@ bool AutoMoc::run()
if (moc_style) {
basename = basename.right(basename.length() - 4);
}
- const QString sourceFilePath = absPath + basename + ".h";
- if (!QFile::exists(sourceFilePath)) {
+ bool headerFound = false;
+ foreach (QString ext, headerExtensions) {
+ QString sourceFilePath = absPath + basename + ext;
+ if (QFile::exists(sourceFilePath)) {
+ headerFound = true;
+ includedMocs.insert(sourceFilePath, currentMoc);
+ notIncludedMocs.remove(sourceFilePath);
+ break;
+ }
+ }
+ if (!headerFound) {
cerr << "kde4automoc: The file \"" << absFilename <<
"\" includes the moc file \"" << currentMoc << "\", but \"" <<
- sourceFilePath << "\" does not exist." << endl;
+ absPath + basename + "{" + headerExtensions.join(",") + "}" <<
+ "\" do not exist." << endl;
::exit(EXIT_FAILURE);
}
- includedMocs.insert(sourceFilePath, currentMoc);
- notIncludedMocs.remove(sourceFilePath);
} else {
includedMocs.insert(absFilename, currentMoc);
notIncludedMocs.remove(absFilename);
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem