diff options
author | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2010-10-05 16:12:03 (GMT) |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@nokia.com> | 2010-10-05 19:11:37 (GMT) |
commit | d75dad653d651eb725b238ad9db4dccd6a1f1d2e (patch) | |
tree | 87c5e4f6abd6a511d91b6134f03c2b358690f8f5 /qmake | |
parent | edb1e43f0ad7aece24929d95542490da7f88321f (diff) | |
download | Qt-d75dad653d651eb725b238ad9db4dccd6a1f1d2e.zip Qt-d75dad653d651eb725b238ad9db4dccd6a1f1d2e.tar.gz Qt-d75dad653d651eb725b238ad9db4dccd6a1f1d2e.tar.bz2 |
qmake: Ensure right library order when reducing duplicate libraries
Commit 3ed9e2788e8 changed the logic from using lookahead to checking
if the library already existed in the arguments parsed so far. This
broke the case -lFoo -lBar -lFoo where Bar depends on symbols in Foo.
Since we were reducing this to -lFoo -lBar, the linker would not know
which missing symbols to include from Foo when encountering the -lFoo
argument.
We now keep the library order when building the final argument list,
by making sure the position of a duplicated library is always that
of the last instance of that library.
Task-number: QTBUG-13944
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/unix/unixmake.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index da4bbb7..c26fcb4 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -636,11 +636,13 @@ UnixMakefileGenerator::processPrlFiles() if(opt.startsWith("-L") || (Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-F"))) { - if(lit == 0 || !lflags[arch].contains(opt)) + if(!lflags[arch].contains(opt)) lflags[arch].append(opt); } else if(opt.startsWith("-l")) { - if(lit == l.size()-1 || !lflags[arch].contains(opt)) - lflags[arch].append(opt); + // Make sure we keep the dependency-order of libraries + if (lflags[arch].contains(opt)) + lflags[arch].removeAll(opt); + lflags[arch].append(opt); } else if(Option::target_mode == Option::TARG_MACX_MODE && opt.startsWith("-framework")) { if(opt.length() > 11) opt = opt.mid(11); @@ -672,7 +674,7 @@ UnixMakefileGenerator::processPrlFiles() lflags[arch].append(opt); } } else if(!opt.isNull()) { - if(lit == 0 || l.lastIndexOf(opt, lit-1) == -1) + if(!lflags[arch].contains(opt)) lflags[arch].append(opt); } } |