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>
This commit is contained in:
Joerg Bornemann 2021-08-17 17:11:20 +02:00
parent ae6a8ddf45
commit b9e8d85fb2

View File

@ -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();