forked from qt-creator/qt-creator
CMake: Make shadowBuildDirectory helper available
Make shadowBuildDirectory(...) a static method of CMakeBuildConfiguration. That way it can be used by a future projectimporter. Change-Id: I1b3ffc821ac9197aa5c90e2b78891df7a81a31dd Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
This commit is contained in:
@@ -60,19 +60,6 @@ namespace Internal {
|
||||
const char INITIAL_ARGUMENTS[] = "CMakeProjectManager.CMakeBuildConfiguration.InitialArgument"; // Obsolete since QtC 3.7
|
||||
const char CONFIGURATION_KEY[] = "CMake.Configuration";
|
||||
|
||||
static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit *k,
|
||||
const QString &bcName, BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
if (projectFilePath.isEmpty())
|
||||
return FileName();
|
||||
|
||||
const QString projectName = projectFilePath.parentDir().fileName();
|
||||
ProjectMacroExpander expander(projectName, k, bcName, buildType);
|
||||
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
|
||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
|
||||
}
|
||||
|
||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
|
||||
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID))
|
||||
{
|
||||
@@ -187,6 +174,21 @@ bool CMakeBuildConfiguration::persistCMakeState()
|
||||
return m_buildDirManager->persistCMakeState();
|
||||
}
|
||||
|
||||
FileName CMakeBuildConfiguration::shadowBuildDirectory(const FileName &projectFilePath,
|
||||
const Kit *k,
|
||||
const QString &bcName,
|
||||
BuildConfiguration::BuildType buildType)
|
||||
{
|
||||
if (projectFilePath.isEmpty())
|
||||
return FileName();
|
||||
|
||||
const QString projectName = projectFilePath.parentDir().fileName();
|
||||
ProjectMacroExpander expander(projectName, k, bcName, buildType);
|
||||
QDir projectDir = QDir(Project::projectDirectory(projectFilePath).toString());
|
||||
QString buildPath = expander.expand(Core::DocumentManager::buildDirectory());
|
||||
return FileName::fromUserInput(projectDir.absoluteFilePath(buildPath));
|
||||
}
|
||||
|
||||
QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration() const
|
||||
{
|
||||
if (m_buildDirManager->isParsing())
|
||||
@@ -363,7 +365,8 @@ QList<ProjectExplorer::BuildInfo *> CMakeBuildConfigurationFactory::availableSet
|
||||
info->displayName = info->typeName;
|
||||
}
|
||||
info->buildDirectory
|
||||
= shadowBuildDirectory(projectPathName, k, info->displayName, info->buildType);
|
||||
= CMakeBuildConfiguration::shadowBuildDirectory(projectPathName, k,
|
||||
info->displayName, info->buildType);
|
||||
result << info;
|
||||
}
|
||||
return result;
|
||||
@@ -380,8 +383,10 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
|
||||
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||
|
||||
if (copy.buildDirectory.isEmpty()) {
|
||||
copy.buildDirectory = shadowBuildDirectory(project->projectFilePath(), parent->kit(),
|
||||
copy.displayName, info->buildType);
|
||||
copy.buildDirectory
|
||||
= CMakeBuildConfiguration::shadowBuildDirectory(project->projectFilePath(),
|
||||
parent->kit(),
|
||||
copy.displayName, info->buildType);
|
||||
}
|
||||
|
||||
auto bc = new CMakeBuildConfiguration(parent);
|
||||
|
||||
Reference in New Issue
Block a user