diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2018-12-14 14:18:39 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@pelagicore.com> | 2018-12-14 17:20:11 +0000 |
commit | 9d76beee5be0812fdc8bd53c3145de95b45ab6a6 (patch) | |
tree | 3b8ba27e8bd460a7c2fc5b331400be3559cff8d1 /qmake | |
parent | 32fd79a20fb9b99913bba1537067f5dc8dd96a38 (diff) |
qmake: don't mess up linking order of libraries
... which are specified by full filepath, by making the de-duplication
consistent with that applied to libs specified with -l, that is, last
one wins.
the problem existed "forever", but it became more visible after the
recent configure changes.
fwiw, Win32MakefileGenerator is not affected, because it has the
opposite problem: it de-duplicates everything (including object files)
in "last one wins mode". it might make sense to change that as well.
Change-Id: Id7ef1d394fcc9d444450672c06a6f11af2b19eab
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index 50ec8db79e..4cbe06d9dc 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -399,6 +399,8 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) libdirs.append(QMakeLocalFileName(dlib.toQString())); frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks")); frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks")); + ProStringList extens; + extens << project->first("QMAKE_EXTENSION_SHLIB") << "a"; static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE", "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr }; for (int i = 0; lflags[i]; i++) { @@ -417,8 +419,6 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) libdirs.insert(libidx++, f); } else if(opt.startsWith("-l")) { QString lib = opt.mid(2); - ProStringList extens; - extens << project->first("QMAKE_EXTENSION_SHLIB") << "a"; for (QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) { QString libBase = (*dep_it).local() + '/' @@ -521,8 +521,18 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags) lflags[arch].append(opt); } } else if(!opt.isNull()) { + for (const ProString &ext : extens) { + if (opt.size() > ext.size() && opt.endsWith(ext) + && opt.at(opt.size() - ext.size() - 1) == '.') { + // Make sure we keep the dependency order of libraries + lflags[arch].removeAll(opt); + lflags[arch].append(opt); + goto found2; + } + } if(!lflags[arch].contains(opt)) lflags[arch].append(opt); + found2: ; } } |