ProjectExplorer: Streamline access to buildDirectoryTemplate data

There's only one kind of use, in the context of BuildConfiguration.

Change-Id: I09628ff443ef08e28738125a614c17d5d979189b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2021-08-24 08:34:32 +02:00
parent cd3c2fdc5b
commit 22ecef0444
15 changed files with 89 additions and 177 deletions

View File

@@ -52,7 +52,6 @@
#include <projectexplorer/namedwidget.h>
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectmacroexpander.h>
#include <projectexplorer/target.h>
#include <qtsupport/baseqtversion.h>
@@ -1067,15 +1066,17 @@ FilePath CMakeBuildConfiguration::shadowBuildDirectory(const FilePath &projectFi
return FilePath();
const QString projectName = projectFilePath.parentDir().fileName();
ProjectMacroExpander expander(projectFilePath, projectName, k, bcName, buildType);
const FilePath projectDir = Project::projectDirectory(projectFilePath);
QString buildPath = expander.expand(ProjectExplorerPlugin::buildDirectoryTemplate());
buildPath.replace(" ", "-");
FilePath buildPath = BuildConfiguration::buildDirectoryFromTemplate(projectDir,
projectFilePath, projectName, k, bcName, buildType, BuildConfiguration::ReplaceSpaces);
if (CMakeGeneratorKitAspect::isMultiConfigGenerator(k))
buildPath = buildPath.left(buildPath.lastIndexOf(QString("-%1").arg(bcName)));
if (CMakeGeneratorKitAspect::isMultiConfigGenerator(k)) {
QString path = buildPath.path();
path = path.left(path.lastIndexOf(QString("-%1").arg(bcName)));
buildPath.setPath(path);
}
return projectDir.resolvePath(buildPath);
return buildPath;
}
void CMakeBuildConfiguration::buildTarget(const QString &buildTarget)