Commit a8853fa8 authored by Tobias Hunger's avatar Tobias Hunger

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: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 68b99dac
......@@ -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);
......
......@@ -77,6 +77,10 @@ public:
void resetData();
bool persistCMakeState();
static Utils::FileName
shadowBuildDirectory(const Utils::FileName &projectFilePath, const ProjectExplorer::Kit *k,
const QString &bcName, BuildConfiguration::BuildType buildType);
signals:
void errorOccured(const QString &message);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment