Simplify multiple config handling.

Use conventional pattern of not repeating the loop body for empty
config.
This commit is contained in:
Stephen Kelly 2014-03-27 09:46:58 +01:00
parent 358be9b320
commit 936e00b92c
3 changed files with 20 additions and 29 deletions

View File

@ -223,18 +223,15 @@ bool cmExportCommand
// Compute the set of configurations exported.
std::vector<std::string> configurationTypes;
this->Makefile->GetConfigurations(configurationTypes);
if(!configurationTypes.empty())
if(configurationTypes.empty())
{
for(std::vector<std::string>::const_iterator
ci = configurationTypes.begin();
ci != configurationTypes.end(); ++ci)
{
ebfg->AddConfiguration(*ci);
}
configurationTypes.push_back("");
}
else
for(std::vector<std::string>::const_iterator
ci = configurationTypes.begin();
ci != configurationTypes.end(); ++ci)
{
ebfg->AddConfiguration("");
ebfg->AddConfiguration(*ci);
}
if (this->ExportSet)
{

View File

@ -135,18 +135,15 @@ void cmGeneratorExpressionEvaluationFile::Generate()
if (allConfigs.empty())
{
this->Generate("", inputExpression.get(), outputFiles);
allConfigs.push_back("");
}
else
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
li != allConfigs.end(); ++li)
{
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
li != allConfigs.end(); ++li)
this->Generate(*li, inputExpression.get(), outputFiles);
if(cmSystemTools::GetFatalErrorOccured())
{
this->Generate(*li, inputExpression.get(), outputFiles);
if(cmSystemTools::GetFatalErrorOccured())
{
return;
}
return;
}
}
}

View File

@ -542,6 +542,10 @@ void cmLocalGenerator::GenerateTargetManifest()
// Collect the set of configuration types.
std::vector<std::string> configNames;
this->Makefile->GetConfigurations(configNames);
if(configNames.empty())
{
configNames.push_back("");
}
// Add our targets to the manifest for each configuration.
cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets();
@ -557,18 +561,11 @@ void cmLocalGenerator::GenerateTargetManifest()
{
continue;
}
if(configNames.empty())
for(std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci)
{
target.GenerateTargetManifest("");
}
else
{
for(std::vector<std::string>::iterator ci = configNames.begin();
ci != configNames.end(); ++ci)
{
const char* config = ci->c_str();
target.GenerateTargetManifest(config);
}
const char* config = ci->c_str();
target.GenerateTargetManifest(config);
}
}
}