diff options
| author | Liang Qi <liang.qi@qt.io> | 2019-08-05 09:28:48 +0200 |
|---|---|---|
| committer | Liang Qi <liang.qi@qt.io> | 2019-08-05 10:03:24 +0200 |
| commit | f3c816befee4d0cd522e503b4eb04e1b3a892a6d (patch) | |
| tree | cf283c7a44bdfc4113d48ec12daa0c3d711aae99 /qmake/generators/unix/unixmake2.cpp | |
| parent | 4d7271087e84096abd75fa806bea234daee0cd94 (diff) | |
| parent | f3b28e80211881ab78879eb5acbf5de5d1b1e38c (diff) | |
Merge "Merge remote-tracking branch 'origin/5.12' into 5.13"
Diffstat (limited to 'qmake/generators/unix/unixmake2.cpp')
| -rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 731821020b7..c326692ded8 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -1454,7 +1454,36 @@ UnixMakefileGenerator::libtoolFileName(bool fixify) void UnixMakefileGenerator::writeLibtoolFile() { + auto fixDependencyLibs + = [this](const ProStringList &libs) + { + ProStringList result; + for (auto lib : libs) { + auto fi = fileInfo(lib.toQString()); + if (fi.isAbsolute()) { + const QString libDirArg = "-L" + fi.path(); + if (!result.contains(libDirArg)) + result += libDirArg; + QString namespec = fi.fileName(); + int dotPos = namespec.lastIndexOf('.'); + if (dotPos != -1 && namespec.startsWith("lib")) { + namespec.truncate(dotPos); + namespec.remove(0, 3); + } else { + debug_msg(1, "Ignoring dependency library %s", + lib.toLatin1().constData()); + continue; + } + result += "-l" + namespec; + } else { + result += lib; + } + } + return result; + }; + QString fname = libtoolFileName(), lname = fname; + debug_msg(1, "Writing libtool file %s", fname.toLatin1().constData()); mkdir(fileInfo(fname).path()); int slsh = lname.lastIndexOf(Option::dir_sep); if(slsh != -1) @@ -1492,12 +1521,11 @@ UnixMakefileGenerator::writeLibtoolFile() << ".a'\n\n"; t << "# Libraries that this one depends upon.\n"; + static const ProKey libVars[] = { "LIBS", "QMAKE_LIBS" }; ProStringList libs; - libs << "LIBS" << "QMAKE_LIBS"; - t << "dependency_libs='"; - for (ProStringList::ConstIterator it = libs.cbegin(); it != libs.cend(); ++it) - t << fixLibFlags((*it).toKey()).join(' ') << ' '; - t << "'\n\n"; + for (auto var : libVars) + libs += fixLibFlags(var); + t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n"; t << "# Version information for " << lname << "\n"; int maj = project->first("VER_MAJ").toInt(); |
