diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-08-17 17:11:20 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-08-17 23:35:23 +0200 |
commit | b9e8d85fb254bbec78d75b7c6d23045a4c8aa965 (patch) | |
tree | a6359a59300f8c7158b60d8cecf8c2d8b71ff295 /qmake | |
parent | ae6a8ddf45567c12bcb2e100756dcf9430010677 (diff) | |
download | qtbase-b9e8d85fb254bbec78d75b7c6d23045a4c8aa965.tar.gz |
Fix framework dependencies in .la files
"-framework Foo" arguments must be placed in the inherited_linker_flags
variables instead of dependency_libs.
Pick-to: 5.15
Fixes: QTBUG-2390
Change-Id: Idec4115533ed1f86f44db64931fa64cadeeb4572
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 190f5e355a..d5a057ef7b 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -37,6 +37,9 @@ #include <qdebug.h> #include <time.h> +#include <tuple> +#include <utility> + QT_BEGIN_NAMESPACE void @@ -1422,6 +1425,25 @@ UnixMakefileGenerator::libtoolFileName(bool fixify) return ret; } +static std::pair<ProStringList, ProStringList> +splitFrameworksAndLibs(const ProStringList &linkArgs) +{ + std::pair<ProStringList, ProStringList> result; + bool frameworkArg = false; + for (auto arg : linkArgs) { + if (frameworkArg) { + frameworkArg = false; + result.second += arg; + } else if (arg == "-framework") { + frameworkArg = true; + result.second += arg; + } else { + result.first += arg; + } + } + return result; +} + void UnixMakefileGenerator::writeLibtoolFile() { @@ -1496,7 +1518,13 @@ UnixMakefileGenerator::writeLibtoolFile() ProStringList libs; for (auto var : libVars) libs += fixLibFlags(var); + ProStringList frameworks; + std::tie(libs, frameworks) = splitFrameworksAndLibs(libs); t << "dependency_libs='" << fixDependencyLibs(libs).join(' ') << "'\n\n"; + if (!frameworks.isEmpty()) { + t << "# Frameworks that this library depends upon.\n"; + t << "inherited_linker_flags='" << frameworks.join(' ') << "'\n\n"; + } t << "# Version information for " << lname << "\n"; int maj = project->first("VER_MAJ").toInt(); |