summaryrefslogtreecommitdiffstats
path: root/qmake/project.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-05-09 12:47:02 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-06-19 16:37:49 +0200
commitd8b2998daeab9bfb7bfb5182960ec09b94885b17 (patch)
tree71dd697bcb8b5b03b4509c41bdf83a3060d56c90 /qmake/project.cpp
parent28f193ab5368bf647d7169abefd2d34af537e18d (diff)
Revert "move finding the makespec to Option"
Needed for an upcoming revert. This reverts commit 74a6669fa7c0d6e2cb7d34d56332d620d2a07755. Conflicts: qmake/option.cpp qmake/project.cpp qmake/property.cpp Change-Id: I56088506d27bf1f095f9261c75224f4bee17ec60 Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'qmake/project.cpp')
-rw-r--r--qmake/project.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 3df80bc00d..612acda2f4 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -602,6 +602,26 @@ QStringList qmake_feature_paths(QMakeProperty *prop=0)
return feature_roots;
}
+QStringList qmake_mkspec_paths()
+{
+ QStringList ret;
+ const QString concat = QLatin1String("/mkspecs");
+ QByteArray qmakepath = qgetenv("QMAKEPATH");
+ if (!qmakepath.isEmpty()) {
+ const QStringList lst = splitPathList(QString::fromLocal8Bit(qmakepath));
+ for (QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
+ ret << ((*it) + concat);
+ }
+ if (!Option::mkfile::project_build_root.isEmpty())
+ ret << Option::mkfile::project_build_root + concat;
+ if (!Option::mkfile::project_root.isEmpty())
+ ret << Option::mkfile::project_root + concat;
+ ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
+ ret.removeDuplicates();
+
+ return ret;
+}
+
QMakeProject::~QMakeProject()
{
if(own_prop)
@@ -1285,6 +1305,29 @@ QMakeProject::read(uchar cmd)
}
{ // parse mkspec
QString qmakespec = Option::mkfile::qmakespec;
+ if (qmakespec.isEmpty())
+ qmakespec = "default";
+ if (QDir::isRelativePath(qmakespec)) {
+ QStringList mkspec_roots = qmake_mkspec_paths();
+ debug_msg(2, "Looking for mkspec %s in (%s)", qmakespec.toLatin1().constData(),
+ mkspec_roots.join("::").toLatin1().constData());
+ bool found_mkspec = false;
+ for (QStringList::ConstIterator it = mkspec_roots.begin(); it != mkspec_roots.end(); ++it) {
+ QString mkspec = (*it) + QLatin1Char('/') + qmakespec;
+ if (QFile::exists(mkspec)) {
+ found_mkspec = true;
+ Option::mkfile::qmakespec = qmakespec = mkspec;
+ break;
+ }
+ }
+ if (!found_mkspec) {
+ fprintf(stderr, "Could not find mkspecs for your QMAKESPEC(%s) after trying:\n\t%s\n",
+ qmakespec.toLatin1().constData(), mkspec_roots.join("\n\t").toLatin1().constData());
+ return false;
+ }
+ }
+
+ // parse qmake configuration
while(qmakespec.endsWith(QLatin1Char('/')))
qmakespec.truncate(qmakespec.length()-1);
QString spec = qmakespec + QLatin1String("/qmake.conf");