summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
Diffstat (limited to 'qmake')
-rw-r--r--qmake/option.cpp4
-rw-r--r--qmake/project.cpp7
2 files changed, 7 insertions, 4 deletions
diff --git a/qmake/option.cpp b/qmake/option.cpp
index 6eeddfd154..714aebe6ef 100644
--- a/qmake/option.cpp
+++ b/qmake/option.cpp
@@ -604,10 +604,10 @@ void Option::prepareProject(const QString &pfile)
dstpath += QLatin1Char('/');
int srcLen = srcpath.length();
int dstLen = dstpath.length();
- int lastSl = 0;
+ int lastSl = -1;
while (++lastSl, srcpath.at(--srcLen) == dstpath.at(--dstLen))
if (srcpath.at(srcLen) == QLatin1Char('/'))
- lastSl = 1;
+ lastSl = 0;
mkfile::source_root = srcpath.left(srcLen + lastSl);
mkfile::build_root = dstpath.left(dstLen + lastSl);
} else {
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 6e79f7a37d..360c0958f1 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -2685,10 +2685,13 @@ QMakeProject::doProjectExpand(QString func, QList<QStringList> args_list,
break;
case E_SHADOWED: {
QString val = QDir::cleanPath(QFileInfo(args.at(0)).absoluteFilePath());
- if (Option::mkfile::source_root.isEmpty())
+ if (Option::mkfile::source_root.isEmpty()) {
ret += val;
- else if (val.startsWith(Option::mkfile::source_root))
+ } else if (val.startsWith(Option::mkfile::source_root)
+ && (val.length() == Option::mkfile::source_root.length()
+ || val.at(Option::mkfile::source_root.length()) == QLatin1Char('/'))) {
ret += Option::mkfile::build_root + val.mid(Option::mkfile::source_root.length());
+ }
break; }
case E_ABSOLUTE_PATH:
if (args.count() > 2)