forked from qt-creator/qt-creator
CMake: Set CMakeRunConfiguration executable and working directory
Since 131c7a1
the executable and base working directory property of
CMakeRunConfiguration objects is no longer set when the project data
is updated. At least the executable is required in the AutoTest plugin.
Change-Id: I31c4cb37983d3983664d178c0f8c08d491f719ad
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -152,7 +152,7 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
|
||||
}
|
||||
|
||||
updateApplicationAndDeploymentTargets();
|
||||
t->updateDefaultRunConfigurations();
|
||||
updateTargetRunConfigurations(t);
|
||||
|
||||
createGeneratedCodeModelSupport();
|
||||
|
||||
@@ -448,6 +448,34 @@ QStringList CMakeProject::filesGeneratedFrom(const QString &sourceFile) const
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeProject::updateTargetRunConfigurations(Target *t)
|
||||
{
|
||||
// *Update* existing runconfigurations (no need to update new ones!):
|
||||
QHash<QString, const CMakeBuildTarget *> buildTargetHash;
|
||||
const QList<CMakeBuildTarget> buildTargetList = buildTargets();
|
||||
foreach (const CMakeBuildTarget &bt, buildTargetList) {
|
||||
if (bt.targetType != ExecutableType || bt.executable.isEmpty())
|
||||
continue;
|
||||
|
||||
buildTargetHash.insert(bt.title, &bt);
|
||||
}
|
||||
|
||||
foreach (RunConfiguration *rc, t->runConfigurations()) {
|
||||
auto cmakeRc = qobject_cast<CMakeRunConfiguration *>(rc);
|
||||
if (!cmakeRc)
|
||||
continue;
|
||||
|
||||
auto btIt = buildTargetHash.constFind(cmakeRc->title());
|
||||
if (btIt != buildTargetHash.constEnd()) {
|
||||
cmakeRc->setExecutable(btIt.value()->executable.toString());
|
||||
cmakeRc->setBaseWorkingDirectory(btIt.value()->workingDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
// create new and remove obsolete RCs using the factories
|
||||
t->updateDefaultRunConfigurations();
|
||||
}
|
||||
|
||||
void CMakeProject::updateApplicationAndDeploymentTargets()
|
||||
{
|
||||
Target *t = activeTarget();
|
||||
|
@@ -123,6 +123,7 @@ private:
|
||||
|
||||
void createGeneratedCodeModelSupport();
|
||||
QStringList filesGeneratedFrom(const QString &sourceFile) const final;
|
||||
void updateTargetRunConfigurations(ProjectExplorer::Target *t);
|
||||
void updateApplicationAndDeploymentTargets();
|
||||
|
||||
ProjectExplorer::Target *m_connectedTarget = nullptr;
|
||||
|
Reference in New Issue
Block a user