summaryrefslogtreecommitdiff
path: root/qmake/generators/unix/unixmake.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@nokia.com>2010-10-05 18:12:03 +0200
committerTor Arne Vestbø <tor.arne.vestbo@nokia.com>2010-10-05 21:11:37 +0200
commitd75dad653d651eb725b238ad9db4dccd6a1f1d2e (patch)
tree87c5e4f6abd6a511d91b6134f03c2b358690f8f5 /qmake/generators/unix/unixmake.cpp
parentedb1e43f0ad7aece24929d95542490da7f88321f (diff)
downloadqt4-tools-d75dad653d651eb725b238ad9db4dccd6a1f1d2e.tar.gz
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/generators/unix/unixmake.cpp')
-rw-r--r--qmake/generators/unix/unixmake.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index da4bbb712d..c26fcb44f2 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);
}
}