forked from qt-creator/qt-creator
Qmake: Move Qt library path after other libraries
Paths are prepended, so the first one to be added is actually the last search path. On a debian machine with system-installed Qt and Qbs, if you execute Qtc from another instance of Qtc with "Add build library search path" checked, LD_LIBRARY_PATH has /usr/lib/x86_64-linux-gnu before $BUILD/lib/qtcreator. This means that the system's Qbs lib will be loaded instead of the one in RPATH, which is bad (i.e. qbs build fails because it cannot find $BUILD/lib/x86_64-linux-gnu/qbs/qbs_processlauncher). Change-Id: Ibe6778ba8a06da1680e034e31a8fee6d9a81c484 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
80bd696270
commit
ade307d807
@@ -332,6 +332,13 @@ void Environment::prependOrSetLibrarySearchPath(const QString &value)
|
||||
}
|
||||
}
|
||||
|
||||
void Environment::prependOrSetLibrarySearchPaths(const QStringList &values)
|
||||
{
|
||||
Utils::reverseForeach(values, [this](const QString &value) {
|
||||
prependOrSetLibrarySearchPath(value);
|
||||
});
|
||||
}
|
||||
|
||||
Environment Environment::systemEnvironment()
|
||||
{
|
||||
return *staticSystemEnvironment();
|
||||
|
@@ -101,6 +101,7 @@ public:
|
||||
void prependOrSetPath(const QString &value);
|
||||
|
||||
void prependOrSetLibrarySearchPath(const QString &value);
|
||||
void prependOrSetLibrarySearchPaths(const QStringList &values);
|
||||
|
||||
void clear();
|
||||
int size() const;
|
||||
|
@@ -314,6 +314,8 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
||||
if (m_isUsingDyldImageSuffix)
|
||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
||||
|
||||
QStringList libraryPaths;
|
||||
|
||||
// The user could be linking to a library found via a -L/some/dir switch
|
||||
// to find those libraries while actually running we explicitly prepend those
|
||||
// dirs to the library search path
|
||||
@@ -327,7 +329,7 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
||||
const QFileInfo fi(dir);
|
||||
if (!fi.isAbsolute())
|
||||
dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir);
|
||||
env.prependOrSetLibrarySearchPath(dir);
|
||||
libraryPaths << dir;
|
||||
} // foreach
|
||||
} // libDirectories
|
||||
} // pro
|
||||
@@ -335,10 +337,11 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
||||
if (qtVersion && m_isUsingLibrarySearchPath) {
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_BINS"));
|
||||
libraryPaths << qtVersion->qmakeProperty("QT_INSTALL_BINS");
|
||||
else
|
||||
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
|
||||
libraryPaths << qtVersion->qmakeProperty("QT_INSTALL_LIBS");
|
||||
}
|
||||
env.prependOrSetLibrarySearchPaths(libraryPaths);
|
||||
}
|
||||
|
||||
QString DesktopQmakeRunConfiguration::buildSystemTarget() const
|
||||
|
Reference in New Issue
Block a user