make /LIBPATH: deduplication code more like in the unix generator

Change-Id: If7e83a46b1a2ad92723a222daffa687d74636858
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2015-06-02 18:28:33 +02:00
parent 5df87614e3
commit d1cebb09b6

View File

@ -94,26 +94,25 @@ Win32MakefileGenerator::findLibraries()
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end();) {
bool remove = false;
QString opt = (*it).toQString();
if(opt.startsWith("/LIBPATH:")) {
QString libpath = opt.mid(9);
QMakeLocalFileName l(libpath);
if (!dirs.contains(l)) {
dirs.append(l);
(*it) = "/LIBPATH:" + l.real();
} else {
remove = true;
QMakeLocalFileName lp(libpath);
if (dirs.contains(lp)) {
it = l.erase(it);
continue;
}
dirs.append(lp);
(*it) = "/LIBPATH:" + lp.real();
} else if(opt.startsWith("-L") || opt.startsWith("/L")) {
QString libpath = Option::fixPathToTargetOS(opt.mid(2), false, false);
QMakeLocalFileName l(libpath);
if(!dirs.contains(l)) {
dirs.append(l);
(*it) = "/LIBPATH:" + l.real();
} else {
remove = true;
QMakeLocalFileName lp(libpath);
if (dirs.contains(lp)) {
it = l.erase(it);
continue;
}
dirs.append(lp);
(*it) = "/LIBPATH:" + lp.real();
} else if(opt.startsWith("-l") || opt.startsWith("/l")) {
QString lib = opt.right(opt.length() - 2), out;
if(!lib.isEmpty()) {
@ -137,11 +136,7 @@ Win32MakefileGenerator::findLibraries()
out = lib + ".lib";
(*it) = out;
}
if(remove) {
it = l.erase(it);
} else {
++it;
}
++it;
}
}
return true;