Allow qmake to find features when using mkspecs in nested dirs
authorSean Harmer <sean.harmer.qnx@kdab.com>
Tue, 6 Mar 2012 18:05:27 +0000 (18:05 +0000)
committerQt by Nokia <qt-info@nokia.com>
Mon, 12 Mar 2012 10:09:24 +0000 (11:09 +0100)
Commit 8e5eb1bddcfc introduced the assumtion that mkspecs are
immediately below the mkspecs directory itself. This is not true for
e.g. unsupported/blackberry-armv7le-qcc.

This commit restores qmake's ability to find the "root" of the mkspecs
collection no matter how deeply the actual mkspecs are nested.

Task-number: QTBUG-24665
Change-Id: I98faaf8e6ae7b8524277aea6c17e685e507e37b3
Reviewed-by: Sean Harmer <sh@theharmers.co.uk>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
qmake/project.cpp

index 8b5ed1e..b82b793 100644 (file)
@@ -579,14 +579,19 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
         // The spec is already platform-dependent, so no subdirs here.
         feature_roots << Option::mkfile::qmakespec + base_concat;
 
+        // Also check directly under the root directory of the mkspecs collection
         QFileInfo specfi(Option::mkfile::qmakespec);
-        if (!specfi.isRoot()) {
-            QDir specdir(specfi.absolutePath());
-            if (specdir.exists(QLatin1String("features"))) {
-                for(QStringList::Iterator concat_it = concat.begin();
-                    concat_it != concat.end(); ++concat_it)
-                    feature_roots << (specdir.path() + (*concat_it));
+        QDir specrootdir(specfi.absolutePath());
+        while (!specrootdir.isRoot()) {
+            const QString specrootpath = specrootdir.path();
+            if (specrootpath.endsWith(mkspecs_concat)) {
+                if (QFile::exists(specrootpath + base_concat))
+                    for (QStringList::Iterator concat_it = concat.begin();
+                         concat_it != concat.end(); ++concat_it)
+                        feature_roots << (specrootpath + (*concat_it));
+                break;
             }
+            specrootdir.cdUp();
         }
     }
     for(QStringList::Iterator concat_it = concat.begin();