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);