Add the ability to add Runconfigurations for cmake-targets we know about

Task: 250415
This commit is contained in:
dt
2009-04-06 17:01:26 +02:00
parent 6a55ca9776
commit 3b6d8b8f4d
3 changed files with 38 additions and 21 deletions

View File

@@ -168,8 +168,11 @@ QStringList CMakeRunConfigurationFactory::canCreate(ProjectExplorer::Project *pr
CMakeProject *pro = qobject_cast<CMakeProject *>(project);
if (!pro)
return QStringList();
// TODO gather all targets and return them here
return QStringList();
QStringList allTargets = pro->targets();
for (int i=0; i<allTargets.size(); ++i) {
allTargets[i] = Constants::CMAKERUNCONFIGURATION + allTargets[i];
}
return allTargets;
}
// used to translate the types to names to display to the user
@@ -193,9 +196,9 @@ QSharedPointer<ProjectExplorer::RunConfiguration> CMakeRunConfigurationFactory::
return rc;
} else {
// Adding new
// TODO extract target from type
QString file = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, file, QString::null, QString::null));
const QString title = type.mid(QString(Constants::CMAKERUNCONFIGURATION).length());
const CMakeTarget &ct = pro->targetForTitle(title);
QSharedPointer<ProjectExplorer::RunConfiguration> rc(new CMakeRunConfiguration(pro, ct.executable, ct.workingDirectory, ct.title));
return rc;
}
}