From e78c3bb620276259066de62a5703747cb4fb4196 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 6 Jun 2012 22:14:41 +0200 Subject: look for mkspecs/ even below .qmake.cache/.conf-determined root otherwise a cache/config in an aggregator project may unduly hide the mkspecs/ of the aggregated project from qmake's view. Change-Id: Idb0b124de071822f8f55463d9f8a4d194ef3130e --- qmake/project.cpp | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) (limited to 'qmake') diff --git a/qmake/project.cpp b/qmake/project.cpp index 58c2b8cb86..fb4d439bef 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1411,20 +1411,25 @@ QMakeProject::read(uchar cmd) } no_cache: - if (project_build_root.isEmpty()) { - QDir srcdir(qmake_getpwd()); - QDir dstdir(Option::output_dir); - do { - // Look for mkspecs/ in source and build. First to win determines the root. - if (dstdir.exists("mkspecs") || srcdir.exists("mkspecs")) { - project_build_root = dstdir.path(); - project_root = srcdir.path(); - if (project_root == project_build_root) - project_root.clear(); - break; - } - } while (!srcdir.isRoot() && srcdir.cdUp() - && dstdir != superdir && !dstdir.isRoot() && dstdir.cdUp()); + // Look for mkspecs/ in source and build. First to win determines the root. + QString sdir = qmake_getpwd(); + QString dir = Option::output_dir; + while (dir != project_build_root) { + if ((dir != sdir && QFileInfo(sdir, QLatin1String("mkspecs")).isDir()) + || QFileInfo(dir, QLatin1String("mkspecs")).isDir()) { + if (dir != sdir) + project_root = sdir; + project_build_root = dir; + break; + } + if (dir == superdir) + break; + QFileInfo qsdfi(sdir); + QFileInfo qdfi(dir); + if (qsdfi.isRoot() || qdfi.isRoot()) + break; + sdir = qsdfi.path(); + dir = qdfi.path(); } if (qmakepath != cached_qmakepath || qmakefeatures != cached_qmakefeatures @@ -3317,11 +3322,13 @@ QMakeProject::doProjectTest(QString func, QList args_list, QHash