Skip to content

Commit

Permalink
Fix library search path order on Windows
Browse files Browse the repository at this point in the history
Commit 2327944 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
5bc9541 and e185f34.

Fixes: QTBUG-73959
Change-Id: I7e951f432bb5f71ce4bcdb18b7102b4380441181
Reviewed-by: Oswald Buddenhagen <[email protected]>
  • Loading branch information
jobor committed Mar 3, 2019
1 parent 55cc93e commit cc7444e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions qmake/generators/win32/winmakefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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();
Expand Down

0 comments on commit cc7444e

Please sign in to comment.