From cc7444eb65fc42f00a33275f6b8d1d3d39f4d715 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 28 Feb 2019 10:02:21 +0100 Subject: 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 --- qmake/generators/win32/winmakefile.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'qmake') diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index 6046e5791e..208af1327f 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -84,6 +84,7 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) if (impexts.isEmpty()) impexts = project->values("QMAKE_EXTENSION_STATICLIB"); QList 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(); -- cgit v1.2.3