Fix library search path order on Windows

Commit 2327944d added the QMAKE_DEFAULT_LIBDIRS to the library search
paths without taking care that explicit library search paths should be
inserted before system search paths.

Copy the behavior of the UnixMakefileGenerator, esp. of commits
5bc9541e and e185f343.

Fixes: QTBUG-73959
Change-Id: I7e951f432bb5f71ce4bcdb18b7102b4380441181
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
This commit is contained in:
Joerg Bornemann 2019-02-28 10:02:21 +01:00
parent 55cc93e9d6
commit cc7444eb65

View File

@ -84,6 +84,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
if (impexts.isEmpty())
impexts = project->values("QMAKE_EXTENSION_STATICLIB");
QList<QMakeLocalFileName> dirs;
int libidx = 0;
for (const ProString &dlib : project->values("QMAKE_DEFAULT_LIBDIRS"))
dirs.append(QMakeLocalFileName(dlib.toQString()));
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
@ -96,11 +97,12 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
LibFlagType type = parseLibFlag(opt, &arg);
if (type == LibFlagPath) {
QMakeLocalFileName lp(arg.toQString());
if (dirs.contains(lp)) {
int idx = dirs.indexOf(lp);
if (idx >= 0 && idx < libidx) {
it = l.erase(it);
continue;
}
dirs.append(lp);
dirs.insert(libidx++, lp);
(*it) = "-L" + lp.real();
} else if (type == LibFlagLib) {
QString lib = arg.toQString();