qmake: Keep -force_load with library when merging linker flags

Without treating -force_load as an option with an argument, we end up
leaving stray -force_loads in the linker line, resulting in build
failures when the following option is a random library then treated
as a file path.

Task-number: QTBUG-66091
Change-Id: I352c50ab67e32ef6b2b5c6a4f90455b20034e207
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
bb10
Tor Arne Vestbø 2018-01-16 14:41:28 +01:00
parent 080fbb55b5
commit c2f041203f
1 changed files with 6 additions and 3 deletions

View File

@ -498,17 +498,20 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
// Make sure we keep the dependency order of libraries
lflags[arch].removeAll(opt);
lflags[arch].append(opt);
} else if (target_mode == TARG_MAC_MODE && opt == "-framework") {
} else if (target_mode == TARG_MAC_MODE
&& (opt == "-framework" || opt == "-force_load")) {
// Handle space separated options
ProString dashOpt = opt;
opt = l.at(++lit);
if (opt.startsWith("-Xarch"))
opt = l.at(++lit); // The user has done the right thing and prefixed each part
for(int x = 0; x < lflags[arch].size(); ++x) {
if (lflags[arch].at(x) == "-framework" && lflags[arch].at(++x) == opt) {
if (lflags[arch].at(x) == dashOpt && lflags[arch].at(++x) == opt) {
lflags[arch].remove(x - 1, 2);
break;
}
}
lflags[arch].append("-framework");
lflags[arch].append(dashOpt);
lflags[arch].append(opt);
} else {
lflags[arch].append(opt);