aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
diff options
context:
space:
mode:
authorTobias Hunger <[email protected]>2020-01-21 14:00:56 +0100
committerTobias Hunger <[email protected]>2020-01-22 12:23:22 +0000
commit2da7d205d4beeb3e781bfbb7bd89212ceb123960 (patch)
treee0157806c9db86969c66f2b70b81dd887cb9c552 /src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
parent5a05c78647d4207e837e7f558cc624c77446c458 (diff)
CMake: Add LD_LIBRARY support
Extract all the information necessary for the "Add build library search path to LD_LIBRARY_PATH" from fileapi and enable the relevant UI in the desktop run configuration. This allows to remove a workaround introduced for QTCREATORBUG-19354. Note that this is only supported by fileapi at this time. Task-number: QTCREATORBUG-23464 Change-Id: I390d26ed8cd559bd7ff8c2701cd3b1cb8e764339 Reviewed-by: Cristian Adam <[email protected]>
Diffstat (limited to 'src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp')
-rw-r--r--src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
index 3115943e885..0ab7ff8e62c 100644
--- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
+++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp
@@ -538,6 +538,14 @@ CMakeBuildConfiguration *CMakeBuildSystem::cmakeBuildConfiguration() const
return m_buildConfiguration;
}
+static Utils::FilePaths librarySearchPaths(const CMakeBuildSystem *bs, const QString &buildKey)
+{
+ const CMakeBuildTarget cmakeBuildTarget
+ = Utils::findOrDefault(bs->buildTargets(), Utils::equal(&CMakeBuildTarget::title, buildKey));
+
+ return cmakeBuildTarget.libraryDirectories;
+}
+
const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
{
QList<BuildTargetInfo> appTargetList;
@@ -548,20 +556,21 @@ const QList<BuildTargetInfo> CMakeBuildSystem::appTargets() const
continue;
if (ct.targetType == ExecutableType || (forAndroid && ct.targetType == DynamicLibraryType)) {
+ const QString buildKey = ct.title;
+
BuildTargetInfo bti;
bti.displayName = ct.title;
bti.targetFilePath = ct.executable;
bti.projectFilePath = ct.sourceDirectory.stringAppended("/");
bti.workingDirectory = ct.workingDirectory;
- bti.buildKey = ct.title;
+ bti.buildKey = buildKey;
bti.usesTerminal = !ct.linksToQtGui;
// Workaround for QTCREATORBUG-19354:
- bti.runEnvModifier = [this](Environment &env, bool) {
- if (HostOsInfo::isWindowsHost()) {
- const Kit *k = target()->kit();
- if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k))
- env.prependOrSetPath(qt->binPath().toString());
+ bti.runEnvModifier = [this, buildKey](Environment &env, bool enabled) {
+ if (enabled) {
+ const Utils::FilePaths paths = librarySearchPaths(this, buildKey);
+ env.prependOrSetLibrarySearchPaths(Utils::transform(paths, &FilePath::toString));
}
};