qmake: make sure QMAKE_LIBS{,_PRIVATE} comes after LIBS{,_PRIVATE}
the early merging of LIBS* into QMAKE_LIBS* meant that we could not interleave them properly. defer the merging until the points of use. Task-number: QTBUG-70779 Started-by: BogDan Vatra <bogdan@kdab.com> Change-Id: I890f98016c3721396a1f0f6f149a9e2b37d56d8e Reviewed-by: Liang Qi <liang.qi@qt.io>
This commit is contained in:
parent
2a3695b7e0
commit
405c73e495
@ -907,9 +907,9 @@
|
||||
|
||||
Platform-specific variables follow the naming pattern of the
|
||||
variables which they extend or modify, but include the name of the relevant
|
||||
platform in their name. For example, \c QMAKE_LIBS can be used to specify a list
|
||||
of libraries that a project needs to link against, and \c QMAKE_LIBS_X11 can be
|
||||
used to extend or override this list.
|
||||
platform in their name. For example, a makespec may use \c QMAKE_LIBS
|
||||
to specify a list of libraries that each project needs to link against,
|
||||
and \c QMAKE_LIBS_X11 would be used to extend this list.
|
||||
|
||||
\target CONFIG
|
||||
\section1 CONFIG
|
||||
@ -2098,10 +2098,12 @@
|
||||
|
||||
\section1 QMAKE_LIBS
|
||||
|
||||
Specifies all project libraries. The value of this variable
|
||||
is typically handled by qmake or
|
||||
Specifies additional libraries each project needs to link against.
|
||||
The value of this variable is typically handled by qmake or
|
||||
\l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
||||
|
||||
To specify libraries in a project file, use \l LIBS instead.
|
||||
|
||||
\section1 QMAKE_LIBS_EGL
|
||||
|
||||
Specifies all EGL libraries when building Qt with OpenGL/ES
|
||||
|
@ -829,7 +829,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if(!project->isActiveConfig("staticlib")) { //DUMP LIBRARIES
|
||||
ProStringList &libdirs = project->values("QMAKE_PBX_LIBPATHS"),
|
||||
&frameworkdirs = project->values("QMAKE_FRAMEWORKPATH");
|
||||
static const char * const libs[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
static const char * const libs[] = { "LIBS", "LIBS_PRIVATE",
|
||||
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
for (int i = 0; libs[i]; i++) {
|
||||
tmp = project->values(libs[i]);
|
||||
for(int x = 0; x < tmp.count();) {
|
||||
@ -1695,6 +1696,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
t << "\t\t\t\t" << writeSettings("OTHER_LDFLAGS",
|
||||
fixListForOutput("SUBLIBS")
|
||||
+ fixListForOutput("QMAKE_LFLAGS")
|
||||
+ fixListForOutput(fixLibFlags("LIBS"))
|
||||
+ fixListForOutput(fixLibFlags("LIBS_PRIVATE"))
|
||||
+ fixListForOutput(fixLibFlags("QMAKE_LIBS"))
|
||||
+ fixListForOutput(fixLibFlags("QMAKE_LIBS_PRIVATE")),
|
||||
SettingsAsList, 6) << ";\n";
|
||||
|
@ -1012,9 +1012,10 @@ MakefileGenerator::writePrlFile(QTextStream &t)
|
||||
t << "QMAKE_PRL_VERSION = " << project->first("VERSION") << endl;
|
||||
if(project->isActiveConfig("staticlib") || project->isActiveConfig("explicitlib")) {
|
||||
ProStringList libs;
|
||||
libs << "QMAKE_LIBS";
|
||||
if(project->isActiveConfig("staticlib"))
|
||||
libs << "QMAKE_LIBS_PRIVATE";
|
||||
if (!project->isActiveConfig("staticlib"))
|
||||
libs << "LIBS" << "QMAKE_LIBS";
|
||||
else
|
||||
libs << "LIBS" << "LIBS_PRIVATE" << "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE";
|
||||
t << "QMAKE_PRL_LIBS =";
|
||||
for (ProStringList::Iterator it = libs.begin(); it != libs.end(); ++it)
|
||||
t << qv(project->values((*it).toKey()));
|
||||
@ -3345,6 +3346,8 @@ MakefileGenerator::writePkgConfigFile()
|
||||
|
||||
if (project->isActiveConfig("staticlib")) {
|
||||
ProStringList libs;
|
||||
libs << "LIBS"; // FIXME: this should not be conditional on staticlib
|
||||
libs << "LIBS_PRIVATE";
|
||||
libs << "QMAKE_LIBS"; // FIXME: this should not be conditional on staticlib
|
||||
libs << "QMAKE_LIBS_PRIVATE";
|
||||
libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
|
||||
|
@ -80,8 +80,6 @@ UnixMakefileGenerator::init()
|
||||
}
|
||||
|
||||
project->values("QMAKE_ORIG_DESTDIR") = project->values("DESTDIR");
|
||||
project->values("QMAKE_LIBS") += project->values("LIBS");
|
||||
project->values("QMAKE_LIBS_PRIVATE") += project->values("LIBS_PRIVATE");
|
||||
if((!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib")) ||
|
||||
(project->isActiveConfig("qt") && project->isActiveConfig("plugin"))) {
|
||||
if(configs.indexOf("dll") == -1) configs.append("dll");
|
||||
@ -118,7 +116,7 @@ UnixMakefileGenerator::init()
|
||||
}
|
||||
ldadd += project->values("QMAKE_FRAMEWORKPATH_FLAGS");
|
||||
}
|
||||
ProStringList &qmklibs = project->values("QMAKE_LIBS");
|
||||
ProStringList &qmklibs = project->values("LIBS");
|
||||
qmklibs = ldadd + qmklibs;
|
||||
if (!project->isEmpty("QMAKE_RPATHDIR") && !project->isEmpty("QMAKE_LFLAGS_RPATH")) {
|
||||
const ProStringList &rpathdirs = project->values("QMAKE_RPATHDIR");
|
||||
@ -396,7 +394,8 @@ UnixMakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
||||
libdirs.append(QMakeLocalFileName(dlib.toQString()));
|
||||
frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
|
||||
frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
|
||||
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
ProStringList &l = project->values(lflags[i]);
|
||||
for (ProStringList::Iterator it = l.begin(); it != l.end(); ) {
|
||||
|
@ -213,7 +213,9 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
||||
if(!project->isActiveConfig("staticlib")) {
|
||||
t << "LINK = " << var("QMAKE_LINK") << endl;
|
||||
t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
|
||||
t << "LIBS = $(SUBLIBS) " << fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
||||
t << "LIBS = $(SUBLIBS) " << fixLibFlags("LIBS").join(' ') << ' '
|
||||
<< fixLibFlags("LIBS_PRIVATE").join(' ') << ' '
|
||||
<< fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
||||
<< fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl;
|
||||
}
|
||||
|
||||
@ -1479,7 +1481,7 @@ UnixMakefileGenerator::writeLibtoolFile()
|
||||
|
||||
t << "# Libraries that this one depends upon.\n";
|
||||
ProStringList libs;
|
||||
libs << "QMAKE_LIBS";
|
||||
libs << "LIBS" << "QMAKE_LIBS";
|
||||
t << "dependency_libs='";
|
||||
for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
|
||||
t << fixLibFlags((*it).toKey()).join(' ') << ' ';
|
||||
|
@ -209,7 +209,7 @@ void MingwMakefileGenerator::init()
|
||||
|
||||
processVars();
|
||||
|
||||
project->values("QMAKE_LIBS") += project->values("RES_FILE");
|
||||
project->values("LIBS") += project->values("RES_FILE");
|
||||
|
||||
if (project->isActiveConfig("dll")) {
|
||||
QString destDir = "";
|
||||
@ -285,6 +285,8 @@ void MingwMakefileGenerator::writeLibsPart(QTextStream &t)
|
||||
t << "LINKER = " << var("QMAKE_LINK") << endl;
|
||||
t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
|
||||
t << "LIBS = "
|
||||
<< fixLibFlags("LIBS").join(' ') << ' '
|
||||
<< fixLibFlags("LIBS_PRIVATE").join(' ') << ' '
|
||||
<< fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
||||
<< fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl;
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ void NmakeMakefileGenerator::init()
|
||||
|
||||
processVars();
|
||||
|
||||
project->values("QMAKE_LIBS") += project->values("RES_FILE");
|
||||
project->values("LIBS") += project->values("RES_FILE");
|
||||
|
||||
if (!project->values("DEF_FILE").isEmpty()) {
|
||||
QString defFileName = fileFixify(project->first("DEF_FILE").toQString());
|
||||
|
@ -457,7 +457,8 @@ ProStringList VcprojGenerator::collectDependencies(QMakeProject *proj, QHash<QSt
|
||||
newDep->dependencies << "idc.exe";
|
||||
|
||||
// Add all unknown libs to the deps
|
||||
QStringList where = QStringList() << "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE";
|
||||
QStringList where = QStringList() << "LIBS" << "LIBS_PRIVATE"
|
||||
<< "QMAKE_LIBS" << "QMAKE_LIBS_PRIVATE";
|
||||
for (QStringList::ConstIterator wit = where.begin();
|
||||
wit != where.end(); ++wit) {
|
||||
const ProStringList &l = tmp_proj.values(ProKey(*wit));
|
||||
@ -748,7 +749,7 @@ void VcprojGenerator::init()
|
||||
projectTarget = Application;
|
||||
} else if(project->first("TEMPLATE") == "vclib") {
|
||||
if(project->isActiveConfig("staticlib")) {
|
||||
project->values("QMAKE_LIBS") += project->values("RES_FILE");
|
||||
project->values("LIBS") += project->values("RES_FILE");
|
||||
projectTarget = StaticLib;
|
||||
} else
|
||||
projectTarget = SharedLib;
|
||||
@ -1084,7 +1085,8 @@ void VcprojGenerator::initLinkerTool()
|
||||
if (!project->values("DEF_FILE").isEmpty())
|
||||
conf.linker.ModuleDefinitionFile = project->first("DEF_FILE").toQString();
|
||||
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
|
||||
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
const auto libs = fixLibFlags(lflags[i]);
|
||||
for (const ProString &lib : libs) {
|
||||
@ -1179,7 +1181,8 @@ void VcprojGenerator::initDeploymentTool()
|
||||
if (!dllPaths.isEmpty() &&
|
||||
!(conf.WinRT && project->first("MSVC_VER").toQString() == "14.0")) {
|
||||
// FIXME: This code should actually resolve the libraries from all Qt modules.
|
||||
ProStringList arg = project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE");
|
||||
ProStringList arg = project->values("LIBS") + project->values("LIBS_PRIVATE")
|
||||
+ project->values("QMAKE_LIBS") + project->values("QMAKE_LIBS_PRIVATE");
|
||||
bool qpaPluginDeployed = false;
|
||||
for (ProStringList::ConstIterator it = arg.constBegin(); it != arg.constEnd(); ++it) {
|
||||
QString dllName = (*it).toQString();
|
||||
|
@ -84,7 +84,8 @@ Win32MakefileGenerator::findLibraries(bool linkPrl, bool mergeLflags)
|
||||
if (impexts.isEmpty())
|
||||
impexts = project->values("QMAKE_EXTENSION_STATICLIB");
|
||||
QList<QMakeLocalFileName> dirs;
|
||||
static const char * const lflags[] = { "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
static const char * const lflags[] = { "LIBS", "LIBS_PRIVATE",
|
||||
"QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", nullptr };
|
||||
for (int i = 0; lflags[i]; i++) {
|
||||
ProStringList &l = project->values(lflags[i]);
|
||||
for (ProStringList::Iterator it = l.begin(); it != l.end();) {
|
||||
@ -225,8 +226,8 @@ void Win32MakefileGenerator::processVars()
|
||||
libs << QLatin1String("-L") + lib;
|
||||
}
|
||||
}
|
||||
project->values("QMAKE_LIBS") += libs + project->values("LIBS");
|
||||
project->values("QMAKE_LIBS_PRIVATE") += project->values("LIBS_PRIVATE");
|
||||
ProStringList &qmklibs = project->values("LIBS");
|
||||
qmklibs = libs + qmklibs;
|
||||
|
||||
if (project->values("TEMPLATE").contains("app")) {
|
||||
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP");
|
||||
@ -651,7 +652,9 @@ void Win32MakefileGenerator::writeLibsPart(QTextStream &t)
|
||||
} else {
|
||||
t << "LINKER = " << var("QMAKE_LINK") << endl;
|
||||
t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
|
||||
t << "LIBS = " << fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
||||
t << "LIBS = " << fixLibFlags("LIBS").join(' ') << ' '
|
||||
<< fixLibFlags("LIBS_PRIVATE").join(' ') << ' '
|
||||
<< fixLibFlags("QMAKE_LIBS").join(' ') << ' '
|
||||
<< fixLibFlags("QMAKE_LIBS_PRIVATE").join(' ') << endl;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user