Xcode: Pay attention to custom configuration types (#13082)

Previously, we were setting the default configuration for a generated
Xcode project to the hard-coded string "Debug" even in cases where users
customized their configuration types such that the list did not contain
"Debug". Now, we use the first string listed in CMAKE_CONFIGURATION_TYPES
as the default config for generated Xcode projects.
This commit is contained in:
David Cole 2012-04-02 15:50:37 -04:00
parent 0454057f8a
commit 0579fa045c
1 changed files with 6 additions and 1 deletions

View File

@ -3023,6 +3023,7 @@ void cmGlobalXCodeGenerator
cmXCodeObject* buildConfigurations = cmXCodeObject* buildConfigurations =
this->CreateObject(cmXCodeObject::OBJECT_LIST); this->CreateObject(cmXCodeObject::OBJECT_LIST);
std::vector<cmXCodeObject*> configs; std::vector<cmXCodeObject*> configs;
const char *defaultConfigName = "Debug";
if(this->XcodeVersion == 15) if(this->XcodeVersion == 15)
{ {
cmXCodeObject* configDebug = cmXCodeObject* configDebug =
@ -3039,6 +3040,10 @@ void cmGlobalXCodeGenerator
for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i) for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i)
{ {
const char* name = this->CurrentConfigurationTypes[i].c_str(); const char* name = this->CurrentConfigurationTypes[i].c_str();
if (0 == i)
{
defaultConfigName = name;
}
cmXCodeObject* config = cmXCodeObject* config =
this->CreateObject(cmXCodeObject::XCBuildConfiguration); this->CreateObject(cmXCodeObject::XCBuildConfiguration);
config->AddAttribute("name", this->CreateString(name)); config->AddAttribute("name", this->CreateString(name));
@ -3060,7 +3065,7 @@ void cmGlobalXCodeGenerator
configlist->AddAttribute("defaultConfigurationIsVisible", configlist->AddAttribute("defaultConfigurationIsVisible",
this->CreateString("0")); this->CreateString("0"));
configlist->AddAttribute("defaultConfigurationName", configlist->AddAttribute("defaultConfigurationName",
this->CreateString("Debug")); this->CreateString(defaultConfigName));
cmXCodeObject* buildSettings = cmXCodeObject* buildSettings =
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
const char* osxArch = const char* osxArch =