diff --git a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp index c7ffe8cb7b..2e3dd0699d 100644 --- a/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/externaltests.cpp @@ -52,6 +52,7 @@ #include #include #include +#include #ifndef DEFAULT_MAKESPEC # error DEFAULT_MAKESPEC not defined @@ -565,7 +566,17 @@ namespace QTest { << makespec() << QLatin1String("project.pro"); qmake.setWorkingDirectory(temporaryDirPath); - qmake.start(QLatin1String("qmake"), args); + + QString cmd = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake"; +#ifdef Q_OS_WIN + cmd.append(".exe"); +#endif + if (!QFile::exists(cmd)) { + cmd = "qmake"; + qWarning("qmake from build not found, fallback to PATH's qmake"); + } + + qmake.start(cmd, args); std_out += "### --- stdout from qmake --- ###\n"; std_err += "### --- stderr from qmake --- ###\n";