forked from qt-creator/qt-creator
CMakeBuildConfiguration: Less qobject_casts more static_casts
CMakeBuildConfigurations can only exist on CMakeProjects Change-Id: I8501e39f133fea854b953f9739e001cae1f2c0ea Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
@@ -56,12 +56,10 @@ const char CMAKE_BC_ID[] = "CMakeProjectManager.CMakeBuildConfiguration";
|
|||||||
const char BUILD_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory";
|
const char BUILD_DIRECTORY_KEY[] = "CMakeProjectManager.CMakeBuildConfiguration.BuildDirectory";
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
|
CMakeBuildConfiguration::CMakeBuildConfiguration(CMakeProject *parent) :
|
||||||
BuildConfiguration(parent, Core::Id(CMAKE_BC_ID))
|
BuildConfiguration(parent, Core::Id(CMAKE_BC_ID))
|
||||||
{
|
{
|
||||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
m_buildDirectory = parent->defaultBuildDirectory();
|
||||||
if (project)
|
|
||||||
m_buildDirectory = project->defaultBuildDirectory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent,
|
||||||
@@ -175,9 +173,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
|||||||
if (!canCreate(parent, id))
|
if (!canCreate(parent, id))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
CMakeProject *project = qobject_cast<CMakeProject *>(parent->project());
|
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
|
||||||
if (!project)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
QString buildConfigurationName = name;
|
QString buildConfigurationName = name;
|
||||||
@@ -191,7 +187,7 @@ CMakeBuildConfiguration *CMakeBuildConfigurationFactory::create(ProjectExplorer:
|
|||||||
if (!ok || buildConfigurationName.isEmpty())
|
if (!ok || buildConfigurationName.isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(parent);
|
CMakeBuildConfiguration *bc = new CMakeBuildConfiguration(project);
|
||||||
bc->setDisplayName(buildConfigurationName);
|
bc->setDisplayName(buildConfigurationName);
|
||||||
|
|
||||||
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
ProjectExplorer::BuildStepList *buildSteps = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class ToolChain;
|
|||||||
namespace CMakeProjectManager {
|
namespace CMakeProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class CMakeProject;
|
||||||
class CMakeBuildConfigurationFactory;
|
class CMakeBuildConfigurationFactory;
|
||||||
|
|
||||||
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
|
||||||
|
|||||||
Reference in New Issue
Block a user