Merge topic 'fix-default-install-config'

dea42d92 install: Fix regression in default configuration selection
This commit is contained in:
Brad King 2015-02-04 12:30:17 -05:00 committed by CMake Topic Stage
commit f560fdddd1
1 changed files with 5 additions and 9 deletions

View File

@ -407,27 +407,23 @@ void cmLocalGenerator::GenerateInstallRules()
this->Makefile->GetConfigurations(configurationTypes, false); this->Makefile->GetConfigurations(configurationTypes, false);
// Choose a default install configuration. // Choose a default install configuration.
const char* default_config = config.c_str(); std::string default_config = config;
const char* default_order[] = {"RELEASE", "MINSIZEREL", const char* default_order[] = {"RELEASE", "MINSIZEREL",
"RELWITHDEBINFO", "DEBUG", 0}; "RELWITHDEBINFO", "DEBUG", 0};
for(const char** c = default_order; *c && !default_config; ++c) for(const char** c = default_order; *c && default_config.empty(); ++c)
{ {
for(std::vector<std::string>::iterator i = configurationTypes.begin(); for(std::vector<std::string>::iterator i = configurationTypes.begin();
i != configurationTypes.end(); ++i) i != configurationTypes.end(); ++i)
{ {
if(cmSystemTools::UpperCase(*i) == *c) if(cmSystemTools::UpperCase(*i) == *c)
{ {
default_config = i->c_str(); default_config = *i;
} }
} }
} }
if(!default_config && !configurationTypes.empty()) if(default_config.empty() && !configurationTypes.empty())
{ {
default_config = configurationTypes[0].c_str(); default_config = configurationTypes[0];
}
if(!default_config)
{
default_config = "Release";
} }
// Create the install script file. // Create the install script file.