Commit e1ffc900 authored by dt's avatar dt
Browse files

Only add the "all" target if the cbp file actually has a all target

parent ee35a0cf
...@@ -524,12 +524,11 @@ QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets() ...@@ -524,12 +524,11 @@ QList<ProjectExplorer::BuildConfigWidget*> CMakeProject::subConfigWidgets()
return list; return list;
} }
// This method is called for new build configurations
// You should probably set some default values in this method
void CMakeProject::newBuildConfiguration(const QString &buildConfiguration) void CMakeProject::newBuildConfiguration(const QString &buildConfiguration)
{ {
// Default to all // Default to all
makeStep()->setBuildTarget(buildConfiguration, "all", true); if (targets().contains("all"))
makeStep()->setBuildTarget(buildConfiguration, "all", true);
CMakeOpenProjectWizard copw(projectManager(), sourceDirectory(), buildDirectory(buildConfiguration), environment(buildConfiguration)); CMakeOpenProjectWizard copw(projectManager(), sourceDirectory(), buildDirectory(buildConfiguration), environment(buildConfiguration));
if (copw.exec() == QDialog::Accepted) { if (copw.exec() == QDialog::Accepted) {
...@@ -571,24 +570,23 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader ...@@ -571,24 +570,23 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
{ {
Project::restoreSettingsImpl(reader); Project::restoreSettingsImpl(reader);
bool hasUserFile = !buildConfigurations().isEmpty(); bool hasUserFile = !buildConfigurations().isEmpty();
MakeStep *makeStep = 0;
if (!hasUserFile) { if (!hasUserFile) {
// Ask the user for where he wants to build it // Ask the user for where he wants to build it
// and the cmake command line // and the cmake command line
CMakeOpenProjectWizard copw(m_manager, sourceDirectory(), ProjectExplorer::Environment::systemEnvironment()); CMakeOpenProjectWizard copw(m_manager, sourceDirectory(), ProjectExplorer::Environment::systemEnvironment());
copw.exec(); copw.exec();
// TODO handle cancel....
qDebug()<<"ccd.buildDirectory()"<<copw.buildDirectory(); qDebug()<<"ccd.buildDirectory()"<<copw.buildDirectory();
// Now create a standard build configuration // Now create a standard build configuration
MakeStep *makeStep = new MakeStep(this); makeStep = new MakeStep(this);
insertBuildStep(0, makeStep); insertBuildStep(0, makeStep);
addBuildConfiguration("all"); addBuildConfiguration("all");
setValue("all", "msvcVersion", copw.msvcVersion()); setValue("all", "msvcVersion", copw.msvcVersion());
makeStep->setBuildTarget("all", "all", true);
if (!copw.buildDirectory().isEmpty()) if (!copw.buildDirectory().isEmpty())
setValue("all", "buildDirectory", copw.buildDirectory()); setValue("all", "buildDirectory", copw.buildDirectory());
//TODO save arguments somewhere copw.arguments() //TODO save arguments somewhere copw.arguments()
...@@ -597,8 +595,6 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader ...@@ -597,8 +595,6 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
insertCleanStep(0, cleanMakeStep); insertCleanStep(0, cleanMakeStep);
cleanMakeStep->setValue("clean", true); cleanMakeStep->setValue("clean", true);
setActiveBuildConfiguration("all"); setActiveBuildConfiguration("all");
} else { } else {
// We have a user file, but we could still be missing the cbp file // We have a user file, but we could still be missing the cbp file
// or simply run createXml with the saved settings // or simply run createXml with the saved settings
...@@ -628,6 +624,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader ...@@ -628,6 +624,9 @@ bool CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
if (!result) if (!result)
return false; return false;
if (!hasUserFile && targets().contains("all"))
makeStep->setBuildTarget("all", "all", true);
m_watcher = new ProjectExplorer::FileWatcher(this); m_watcher = new ProjectExplorer::FileWatcher(this);
connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString))); connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(fileChanged(QString)));
m_watcher->addFile(m_fileName); m_watcher->addFile(m_fileName);
......
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