Do not write 'Libs:' into .pc files if TEMPLATE is not 'lib'

Especially for header modules we don't want a 'Libs:' entry in their
.pc file.

Task-number: QTBUG-75901
Change-Id: I39037d3132e39dd360532e1425f794ebec28e0bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Joerg Bornemann 2019-06-03 14:52:49 +02:00
parent 60136b1a84
commit c64f8ca232

View File

@ -3359,42 +3359,44 @@ MakefileGenerator::writePkgConfigFile()
if (!version.isEmpty()) if (!version.isEmpty())
t << "Version: " << version << endl; t << "Version: " << version << endl;
// libs if (project->first("TEMPLATE") == "lib") {
t << "Libs: "; // libs
QString pkgConfiglibName; t << "Libs: ";
if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) { QString pkgConfiglibName;
if (libDir != QLatin1String("/Library/Frameworks")) if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")) {
t << "-F${libdir} "; if (libDir != QLatin1String("/Library/Frameworks"))
ProString bundle; t << "-F${libdir} ";
if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME")) ProString bundle;
bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"); if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
else bundle = project->first("QMAKE_FRAMEWORK_BUNDLE_NAME");
bundle = project->first("TARGET"); else
int suffix = bundle.lastIndexOf(".framework"); bundle = project->first("TARGET");
if (suffix != -1) int suffix = bundle.lastIndexOf(".framework");
bundle = bundle.left(suffix); if (suffix != -1)
t << "-framework "; bundle = bundle.left(suffix);
pkgConfiglibName = bundle.toQString(); t << "-framework ";
} else { pkgConfiglibName = bundle.toQString();
if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir)) } else {
t << "-L${libdir} "; if (!project->values("QMAKE_DEFAULT_LIBDIRS").contains(libDir))
pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET"); t << "-L${libdir} ";
if (project->isActiveConfig("shared")) pkgConfiglibName = "-l" + project->first("QMAKE_ORIG_TARGET");
pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString(); if (project->isActiveConfig("shared"))
} pkgConfiglibName += project->first("TARGET_VERSION_EXT").toQString();
t << shellQuote(pkgConfiglibName) << " \n"; }
t << shellQuote(pkgConfiglibName) << " \n";
if (project->isActiveConfig("staticlib")) { if (project->isActiveConfig("staticlib")) {
ProStringList libs; ProStringList libs;
libs << "LIBS"; // FIXME: this should not be conditional on staticlib libs << "LIBS"; // FIXME: this should not be conditional on staticlib
libs << "LIBS_PRIVATE"; libs << "LIBS_PRIVATE";
libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
libs << "QMAKE_LIBS_PRIVATE"; libs << "QMAKE_LIBS_PRIVATE";
libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread? libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
t << "Libs.private:"; t << "Libs.private:";
for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
t << ' ' << fixLibFlags((*it).toKey()).join(' '); t << ' ' << fixLibFlags((*it).toKey()).join(' ');
t << endl; t << endl;
}
} }
// flags // flags