From e800f831e144c81d49a68b6fc7b71d4b7ebdd94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Corbasson?= Date: Tue, 11 Dec 2007 18:58:14 +0000 Subject: Add support to automoc for .hxx, .hpp, .H header files. Approved on kde-buildsystem. svn path=/trunk/KDE/kdelibs/; revision=747344 --- automoc/kde4automoc.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'automoc/kde4automoc.cpp') diff --git a/automoc/kde4automoc.cpp b/automoc/kde4automoc.cpp index 1998766f..67a334a1 100644 --- a/automoc/kde4automoc.cpp +++ b/automoc/kde4automoc.cpp @@ -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)) { - cerr << "kde4automoc: The file \"" << absFilename << - "\" includes the moc file \"" << currentMoc << "\", but \"" << - sourceFilePath << "\" does not exist." << endl; - ::exit(EXIT_FAILURE); + 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 \"" << + 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); -- cgit v1.2.1