summaryrefslogtreecommitdiffstats
path: root/qmake
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-06-01 15:22:18 +0200
committerOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>2015-10-01 16:19:33 +0000
commitcbbeed519b8bd98de71bd93c51c682f9d11158bd (patch)
tree1d3ddf6fa9b53b433e536a6d3010d6fccb9013b4 /qmake
parentf734599629ca30866fcefcc1cfea72a2d77462c3 (diff)
remove magic patching up of libraries specified by file name
the assumption is that if somebody bothers to actually specify a file name, they'll most probably go all the way to specify the *correct* file name. otherwise, they'll use -L/-l flags to specify the libs in a cross-platform way and rely on qmake's magic. this code was initially added for the purpose of invoking findHighestVersion() under windows. this has been off by default for a while now. at some point, the code did also swap qt for qt-mt and vice versa if the specified one was missing. this is obviously gone for a while as well. the unix code was pretty much broken since day one: there was a regex match on lib<stub>.* against <stub> itself, which obviously could not have ever succeeded. consequently, the subsequent code ran into a path that tried the file name with a trailing dot (instead of a new extension), which never produced anything meaningful. [ChangeLog][qmake][Important Behavior Changes] The library lookup has been simplified. It may be necessary to be more explicit in some edge cases now. Change-Id: I5804943f1f7a16d38932b31675caabbda33eada7 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'qmake')
-rw-r--r--qmake/generators/unix/unixmake.cpp72
-rw-r--r--qmake/generators/win32/winmakefile.cpp34
2 files changed, 24 insertions, 82 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index 1a1ba58dd1..0cd0ee596f 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -432,7 +432,7 @@ UnixMakefileGenerator::findLibraries()
for (int i = 0; lflags[i]; i++) {
ProStringList &l = project->values(lflags[i]);
for (ProStringList::Iterator it = l.begin(); it != l.end(); ) {
- QString stub, dir, extn, opt = (*it).toQString();
+ QString opt = (*it).toQString();
if(opt.startsWith("-")) {
if(opt.startsWith("-L")) {
QString lib = opt.mid(2);
@@ -444,63 +444,39 @@ UnixMakefileGenerator::findLibraries()
}
libdirs.insert(libidx++, f);
} else if(opt.startsWith("-l")) {
- stub = opt.mid(2);
- } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
- if (opt.length() == 10)
- ++it;
- // Skip
- }
- } else {
- extn = dir = "";
- stub = opt;
- int slsh = opt.lastIndexOf(Option::dir_sep);
- if(slsh != -1) {
- dir = opt.left(slsh);
- stub = opt.mid(slsh+1);
- }
- QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
- if(stub_reg.exactMatch(stub)) {
- stub = stub_reg.cap(1);
- extn = stub_reg.cap(2);
- }
- }
- if(!stub.isEmpty()) {
- stub += project->first(ProKey("QMAKE_" + stub.toUpper() + "_SUFFIX")).toQString();
- bool found = false;
- ProStringList extens;
- if(!extn.isNull())
- extens << extn;
- else
+ QString lib = opt.mid(2);
+ lib += project->first(ProKey("QMAKE_" + lib.toUpper() + "_SUFFIX")).toQString();
+ bool found = false;
+ ProStringList extens;
extens << project->first("QMAKE_EXTENSION_SHLIB") << "a";
- for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
- if(dir.isNull()) {
- for(QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin(); dep_it != libdirs.end(); ++dep_it) {
+ for (ProStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
+ for (QList<QMakeLocalFileName>::Iterator dep_it = libdirs.begin();
+ dep_it != libdirs.end(); ++dep_it) {
QString pathToLib = ((*dep_it).local() + '/'
+ project->first("QMAKE_PREFIX_SHLIB")
- + stub + "." + (*extit));
- if(exists(pathToLib)) {
- (*it) = "-l" + stub;
+ + lib + '.' + (*extit));
+ if (exists(pathToLib)) {
+ (*it) = "-l" + lib;
found = true;
break;
}
}
- } else {
- QString lib = dir + project->first("QMAKE_PREFIX_SHLIB") + stub + "." + (*extit);
- if (exists(lib)) {
- (*it) = lib;
- found = true;
- break;
- }
}
- }
- if(!found && project->isActiveConfig("compile_libtool")) {
- for(int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
- if (exists(libdirs[dep_i].local() + '/' + project->first("QMAKE_PREFIX_SHLIB") + stub + Option::libtool_ext)) {
- (*it) = libdirs[dep_i].real() + Option::dir_sep + project->first("QMAKE_PREFIX_SHLIB") + stub + Option::libtool_ext;
- found = true;
- break;
+ if (!found && project->isActiveConfig("compile_libtool")) {
+ for (int dep_i = 0; dep_i < libdirs.size(); ++dep_i) {
+ if (exists(libdirs[dep_i].local() + '/'
+ + project->first("QMAKE_PREFIX_SHLIB") + lib + Option::libtool_ext)) {
+ (*it) = libdirs[dep_i].real() + Option::dir_sep
+ + project->first("QMAKE_PREFIX_SHLIB") + lib + Option::libtool_ext;
+ found = true;
+ break;
+ }
}
}
+ } else if (target_mode == TARG_MAC_MODE && opt.startsWith("-framework")) {
+ if (opt.length() == 10)
+ ++it;
+ // Skip
}
}
++it;
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 07e3531420..2059cc7585 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -156,40 +156,6 @@ Win32MakefileGenerator::findLibraries()
if(out.isEmpty())
out = lib + ".lib";
(*it) = out;
- } else if (!exists(Option::normalizePath(opt))) {
- QList<QMakeLocalFileName> lib_dirs;
- QString file = Option::fixPathToTargetOS(opt);
- int slsh = file.lastIndexOf(Option::dir_sep);
- if(slsh != -1) {
- lib_dirs.append(QMakeLocalFileName(file.left(slsh+1)));
- file = file.right(file.length() - slsh - 1);
- } else {
- lib_dirs = dirs;
- }
- if(file.endsWith(".lib")) {
- file = file.left(file.length() - 4);
- if(!file.at(file.length()-1).isNumber()) {
- ProString suffix = project->first(ProKey("QMAKE_" + file.toUpper() + "_SUFFIX"));
- for(QList<QMakeLocalFileName>::Iterator dep_it = lib_dirs.begin(); dep_it != lib_dirs.end(); ++dep_it) {
- QString lib_tmpl(file + "%1" + suffix + ".lib");
- int ver = findHighestVersion((*dep_it).local(), file);
- if(ver != -1) {
- if(ver)
- lib_tmpl = lib_tmpl.arg(ver);
- else
- lib_tmpl = lib_tmpl.arg("");
- if(slsh != -1) {
- QString dir = (*dep_it).real();
- if(!dir.endsWith(Option::dir_sep))
- dir += Option::dir_sep;
- lib_tmpl.prepend(dir);
- }
- (*it) = lib_tmpl;
- break;
- }
- }
- }
- }
}
if(remove) {
it = l.erase(it);