forked from qt-creator/qt-creator
CMake: Unify setup of default build target in CMakeBuildStep
Change-Id: I3d087356a4dd5a3b8ab07d5b64cd5aeb93ae0f47 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -545,15 +545,10 @@ ProjectExplorer::BuildConfiguration *CMakeBuildConfigurationFactory::create(Proj
|
||||
|
||||
auto cleanStep = new CMakeBuildStep(cleanSteps);
|
||||
cleanSteps->insertStep(0, cleanStep);
|
||||
cleanStep->setBuildTarget(CMakeBuildStep::cleanTarget());
|
||||
|
||||
bc->setBuildDirectory(copy.buildDirectory);
|
||||
bc->setCMakeConfiguration(copy.configuration);
|
||||
|
||||
// Default to all
|
||||
if (project->hasBuildTarget(CMakeBuildStep::allTarget()))
|
||||
buildStep->setBuildTarget(CMakeBuildStep::allTarget());
|
||||
|
||||
return bc;
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,16 @@ void CMakeBuildStep::ctor(BuildStepList *bsl)
|
||||
bc = qobject_cast<CMakeBuildConfiguration *>(t->activeBuildConfiguration());
|
||||
}
|
||||
|
||||
// Set a good default build target:
|
||||
if (m_buildTarget.isEmpty()) {
|
||||
if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
||||
setBuildTarget(cleanTarget());
|
||||
else if (bsl->id() == ProjectExplorer::Constants::BUILDSTEPS_DEPLOY)
|
||||
setBuildTarget(installTarget());
|
||||
else
|
||||
setBuildTarget(allTarget());
|
||||
}
|
||||
|
||||
connect(target(), &Target::kitChanged, this, &CMakeBuildStep::cmakeCommandChanged);
|
||||
connect(bc, &CMakeBuildConfiguration::dataAvailable, this, &CMakeBuildStep::handleBuildTargetChanges);
|
||||
}
|
||||
@@ -554,10 +564,7 @@ QList<BuildStepInfo> CMakeBuildStepFactory::availableSteps(BuildStepList *parent
|
||||
BuildStep *CMakeBuildStepFactory::create(BuildStepList *parent, Core::Id id)
|
||||
{
|
||||
Q_UNUSED(id);
|
||||
auto step = new CMakeBuildStep(parent);
|
||||
if (parent->id() == ProjectExplorer::Constants::BUILDSTEPS_CLEAN)
|
||||
step->setBuildTarget(CMakeBuildStep::cleanTarget());
|
||||
return step;
|
||||
return new CMakeBuildStep(parent);
|
||||
}
|
||||
|
||||
BuildStep *CMakeBuildStepFactory::clone(BuildStepList *parent, BuildStep *source)
|
||||
|
||||
Reference in New Issue
Block a user