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()
|
Environment Environment::systemEnvironment()
|
||||||
{
|
{
|
||||||
return *staticSystemEnvironment();
|
return *staticSystemEnvironment();
|
||||||
|
@@ -101,6 +101,7 @@ public:
|
|||||||
void prependOrSetPath(const QString &value);
|
void prependOrSetPath(const QString &value);
|
||||||
|
|
||||||
void prependOrSetLibrarySearchPath(const QString &value);
|
void prependOrSetLibrarySearchPath(const QString &value);
|
||||||
|
void prependOrSetLibrarySearchPaths(const QStringList &values);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
int size() const;
|
int size() const;
|
||||||
|
@@ -314,6 +314,8 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
|||||||
if (m_isUsingDyldImageSuffix)
|
if (m_isUsingDyldImageSuffix)
|
||||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
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
|
// 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
|
// to find those libraries while actually running we explicitly prepend those
|
||||||
// dirs to the library search path
|
// dirs to the library search path
|
||||||
@@ -327,7 +329,7 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
|||||||
const QFileInfo fi(dir);
|
const QFileInfo fi(dir);
|
||||||
if (!fi.isAbsolute())
|
if (!fi.isAbsolute())
|
||||||
dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir);
|
dir = QDir::cleanPath(proDirectory + QLatin1Char('/') + dir);
|
||||||
env.prependOrSetLibrarySearchPath(dir);
|
libraryPaths << dir;
|
||||||
} // foreach
|
} // foreach
|
||||||
} // libDirectories
|
} // libDirectories
|
||||||
} // pro
|
} // pro
|
||||||
@@ -335,10 +337,11 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
|||||||
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit());
|
||||||
if (qtVersion && m_isUsingLibrarySearchPath) {
|
if (qtVersion && m_isUsingLibrarySearchPath) {
|
||||||
if (HostOsInfo::isWindowsHost())
|
if (HostOsInfo::isWindowsHost())
|
||||||
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_BINS"));
|
libraryPaths << qtVersion->qmakeProperty("QT_INSTALL_BINS");
|
||||||
else
|
else
|
||||||
env.prependOrSetLibrarySearchPath(qtVersion->qmakeProperty("QT_INSTALL_LIBS"));
|
libraryPaths << qtVersion->qmakeProperty("QT_INSTALL_LIBS");
|
||||||
}
|
}
|
||||||
|
env.prependOrSetLibrarySearchPaths(libraryPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::buildSystemTarget() const
|
QString DesktopQmakeRunConfiguration::buildSystemTarget() const
|
||||||
|
Reference in New Issue
Block a user