diff options
| author | Loïc Corbasson <loic.corbasson@gmail.com> | 2007-12-11 18:58:14 +0000 | 
|---|---|---|
| committer | Loïc Corbasson <loic.corbasson@gmail.com> | 2007-12-11 18:58:14 +0000 | 
| commit | e800f831e144c81d49a68b6fc7b71d4b7ebdd94a (patch) | |
| tree | b40ae5dc52327fbdde8ec7f8d9db490178418a26 | |
| parent | 3af101066917d7d017614540e91fa1487dd8331e (diff) | |
| download | extra-cmake-modules-e800f831e144c81d49a68b6fc7b71d4b7ebdd94a.tar.gz extra-cmake-modules-e800f831e144c81d49a68b6fc7b71d4b7ebdd94a.tar.bz2 | |
Add support to automoc for .hxx, .hpp, .H header files.
Approved on kde-buildsystem.
svn path=/trunk/KDE/kdelibs/; revision=747344
| -rw-r--r-- | automoc/kde4automoc.cpp | 26 | 
1 files changed, 18 insertions, 8 deletions
| 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); | 
