qmake: fix the precedence of QMAKE_LIBDIR_POST
it must end up in front of QMAKE_LIBS{,_PRIVATE}, but not of LIBS{,_PRIVATE} (which are preceded by QMAKE_LIBDIR). Task-number: QTBUG-61982 Started-by: Liang Qi <liang.qi@qt.io> Change-Id: Id3de01ee0e9b66af02f79949aeb5a0eabd55363f Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
342b13944c
commit
473d9a5fc7
@ -2061,7 +2061,19 @@
|
||||
|
||||
\section1 QMAKE_LIBDIR
|
||||
|
||||
Specifies a list of system library paths.
|
||||
Specifies a list of library search paths for all projects.
|
||||
The value of this variable is typically handled by qmake
|
||||
or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
||||
|
||||
To specify additional search paths in project files,
|
||||
use \l LIBS like that, instead:
|
||||
\badcode
|
||||
LIBS += -L/path/to/libraries
|
||||
\endcode
|
||||
|
||||
\section1 QMAKE_LIBDIR_POST
|
||||
|
||||
Specifies a list of system library search paths for all projects.
|
||||
The value of this variable is typically handled by qmake
|
||||
or \l{#QMAKESPEC}{qmake.conf} and rarely needs to be modified.
|
||||
|
||||
|
@ -37,6 +37,17 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
ProStringList UnixMakefileGenerator::libdirToFlags(const ProKey &key)
|
||||
{
|
||||
ProStringList results;
|
||||
for (const auto &libdir : qAsConst(project->values(key))) {
|
||||
if (!project->isEmpty("QMAKE_LFLAGS_RPATH") && project->isActiveConfig("rpath_libdirs"))
|
||||
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdir;
|
||||
results.append("-L" + escapeFilePath(libdir));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
void
|
||||
UnixMakefileGenerator::init()
|
||||
{
|
||||
@ -93,21 +104,13 @@ UnixMakefileGenerator::init()
|
||||
project->isActiveConfig("dll"))
|
||||
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PREBIND");
|
||||
project->values("QMAKE_INCDIR") += project->values("QMAKE_INCDIR_POST");
|
||||
project->values("QMAKE_LIBDIR") += project->values("QMAKE_LIBDIR_POST");
|
||||
project->values("QMAKE_RPATHDIR") += project->values("QMAKE_RPATHDIR_POST");
|
||||
project->values("QMAKE_RPATHLINKDIR") += project->values("QMAKE_RPATHLINKDIR_POST");
|
||||
if(!project->isEmpty("QMAKE_INCDIR"))
|
||||
project->values("INCLUDEPATH") += project->values("QMAKE_INCDIR");
|
||||
ProStringList ldadd;
|
||||
if(!project->isEmpty("QMAKE_LIBDIR")) {
|
||||
const ProStringList &libdirs = project->values("QMAKE_LIBDIR");
|
||||
for(int i = 0; i < libdirs.size(); ++i) {
|
||||
if(!project->isEmpty("QMAKE_LFLAGS_RPATH") && project->isActiveConfig("rpath_libdirs"))
|
||||
project->values("QMAKE_LFLAGS") += var("QMAKE_LFLAGS_RPATH") + libdirs[i];
|
||||
project->values("QMAKE_LIBDIR_FLAGS") += "-L" + escapeFilePath(libdirs[i]);
|
||||
}
|
||||
}
|
||||
ldadd += project->values("QMAKE_LIBDIR_FLAGS");
|
||||
// The order of the next two lines is relevant due to side effect on QMAKE_LFLAGS.
|
||||
ProStringList ldadd = project->values("QMAKE_LIBDIR_FLAGS") + libdirToFlags("QMAKE_LIBDIR");
|
||||
ProStringList ldaddpost = libdirToFlags("QMAKE_LIBDIR_POST");
|
||||
if (project->isActiveConfig("mac")) {
|
||||
if (!project->isEmpty("QMAKE_FRAMEWORKPATH")) {
|
||||
const ProStringList &fwdirs = project->values("QMAKE_FRAMEWORKPATH");
|
||||
@ -118,6 +121,8 @@ UnixMakefileGenerator::init()
|
||||
}
|
||||
ProStringList &qmklibs = project->values("LIBS");
|
||||
qmklibs = ldadd + qmklibs;
|
||||
ProStringList &qmklibspost = project->values("QMAKE_LIBS");
|
||||
qmklibspost = ldaddpost + qmklibspost;
|
||||
if (!project->isEmpty("QMAKE_RPATHDIR") && !project->isEmpty("QMAKE_LFLAGS_RPATH")) {
|
||||
const ProStringList &rpathdirs = project->values("QMAKE_RPATHDIR");
|
||||
for (int i = 0; i < rpathdirs.size(); ++i) {
|
||||
|
@ -66,6 +66,7 @@ protected:
|
||||
|
||||
private:
|
||||
void init2();
|
||||
ProStringList libdirToFlags(const ProKey &key);
|
||||
};
|
||||
|
||||
inline UnixMakefileGenerator::~UnixMakefileGenerator()
|
||||
|
Loading…
Reference in New Issue
Block a user