qmake: Do not mix canonical and non canonical paths

When having Qt sources in a symbolic link "shadowed" did not work
because _PRO_FILE_PWD_ used canonical path, while source_root did not.
Due to this mix it was possible that shadowedPath did not find any
"common denominator" and always returned and empty string. The first
place where things broke was while running config.tests.

Task-number: QTBUG-59319
Change-Id: If73ecbc58290ee9113f887a73c312ebfb5e20a33
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
This commit is contained in:
Oliver Wolff 2017-04-03 15:44:36 +02:00
parent 46c66bce5d
commit 2019e78d87

View File

@ -462,7 +462,9 @@ Option::init(int argc, char **argv)
void Option::prepareProject(const QString &pfile)
{
QString srcpath = QDir::cleanPath(QFileInfo(pfile).absolutePath());
// Canonicalize only the directory, otherwise things will go haywire
// if the file itself is a symbolic link.
const QString srcpath = QFileInfo(QFileInfo(pfile).absolutePath()).canonicalFilePath();
globals->setDirectories(srcpath, output_dir);
}