From 38cd7b1aa078d35262dbe19f70ef6afbe6538e6e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 15 Jan 2020 16:47:54 +0100 Subject: [PATCH] ProjectExplorer: Use different build dir when copying build config ...into another target. Using the same build directory in two different targets will likely lead to errors. Fixes: QTCREATORBUG-23462 Change-Id: I7daa510b3128a344adb51772d44a79415419acc3 Reviewed-by: hjk --- src/plugins/projectexplorer/project.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index c549b53e832..c2f20a6ccd1 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -33,6 +33,7 @@ #include "kit.h" #include "makestep.h" #include "projectexplorer.h" +#include "projectmacroexpander.h" #include "projectnodes.h" #include "runconfiguration.h" #include "runcontrol.h" @@ -405,13 +406,19 @@ bool Project::copySteps(Target *sourceTarget, Target *newTarget) QStringList deployconfigurationError; QStringList runconfigurationError; + const Project * const project = newTarget->project(); foreach (BuildConfiguration *sourceBc, sourceTarget->buildConfigurations()) { + ProjectMacroExpander expander(project->projectFilePath(), project->displayName(), + newTarget->kit(), sourceBc->displayName(), + sourceBc->buildType()); BuildConfiguration *newBc = BuildConfigurationFactory::clone(newTarget, sourceBc); if (!newBc) { buildconfigurationError << sourceBc->displayName(); continue; } newBc->setDisplayName(sourceBc->displayName()); + newBc->setBuildDirectory(project->projectDirectory() + .resolvePath(expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate()))); newTarget->addBuildConfiguration(newBc); if (sourceTarget->activeBuildConfiguration() == sourceBc) SessionManager::setActiveBuildConfiguration(newTarget, newBc, SetActive::NoCascade);