MantisBT - CMake
View Issue Details
0013082CMakeCMakepublic2012-03-30 17:232012-09-03 16:02
Michael Toy 
David Cole 
normalmajoralways
closedfixed 
Apple MacOS X10.4.10
CMake 2.8.7 
CMake 2.8.8CMake 2.8.8 
0013082: Projects without a build configuration called "Debug" do not load in XCode 4.3
If CMAKE_CONFIGURATION_TYPES does not include a configuration called "Debug", then the generated XCode project will not load in XCode 4.3.

You get the message: "Project *mumble*.xcodeproj cannot be opened: The project contains has no default build configuration - it may have been damaged"

Examining the project file, I see this reference to a non existent configuration "Debug", which, if I edit by hand to a legal configuration, allows XCode 4.3 to open the project.

/* Begin XCConfigurationList section */
              112307722465449CAB35CE62 /* Build configuration list for PBXProject "MUMBLE" */ = {
                     isa = XCConfigurationList;
                     buildConfigurations = (
                            405A72F866C04328BAC5995E /* Release */,
                            4337EF4DA71245D9A159CB90 /* Instrumented */,
                     );
                     defaultConfigurationIsVisible = 0;
                     defaultConfigurationName = Debug;
              };

Which is caused by these lines in cmGlobalXCodeGenerator.cxx
( from method cmGlobalXCodeGenerator::CreateXCodeObjects )

  std::string comment = "Build configuration list for PBXProject ";
  comment += " \"";
  comment += this->CurrentProject;
  comment += "\"";
  configlist->SetComment(comment.c_str());
  configlist->AddAttribute("defaultConfigurationIsVisible",
                           this->CreateString("0"));
  configlist->AddAttribute("defaultConfigurationName",
                           this->CreateString("Debug"));
No tags attached.
related to 0012621closed David Cole Compatibility with Xcode 4.3 
Issue History
2012-03-30 17:23Michael ToyNew Issue
2012-03-30 17:57Michael ToyNote Added: 0029018
2012-04-02 08:38Brad KingRelationship addedrelated to 0012621
2012-04-02 08:39Brad KingAssigned To => David Cole
2012-04-02 08:39Brad KingStatusnew => assigned
2012-04-02 16:01David ColeNote Added: 0029059
2012-04-02 16:01David ColeStatusassigned => resolved
2012-04-02 16:01David ColeResolutionopen => fixed
2012-04-19 15:55David ColeFixed in Version => CMake 2.8.8
2012-04-19 15:55David ColeTarget Version => CMake 2.8.8
2012-09-03 16:02David ColeNote Added: 0030888
2012-09-03 16:02David ColeStatusresolved => closed

Notes
(0029018)
Michael Toy   
2012-03-30 17:57   
Here's a diff for a patch which seems to fix the problem, but I not not familiar enough with the code to know if this is a good, leak free, crash safe fix.

Index: Source/cmGlobalXCodeGenerator.cxx
===================================================================
--- Source/cmGlobalXCodeGenerator.cxx (revision 106760)
+++ Source/cmGlobalXCodeGenerator.cxx (working copy)
@@ -2888,6 +2888,7 @@
   cmXCodeObject* buildConfigurations =
     this->CreateObject(cmXCodeObject::OBJECT_LIST);
   std::vector<cmXCodeObject*> configs;
+ const char *defaultconfigname = "Debug";
   if(this->XcodeVersion == 15)
     {
     cmXCodeObject* configDebug =
@@ -2904,6 +2905,10 @@
     for(unsigned int i = 0; i < this->CurrentConfigurationTypes.size(); ++i)
       {
       const char* name = this->CurrentConfigurationTypes[i].c_str();
+ if( i == 0 )
+ {
+ defaultconfigname = name;
+ }
       cmXCodeObject* config =
         this->CreateObject(cmXCodeObject::XCBuildConfiguration);
       config->AddAttribute("name", this->CreateString(name));
@@ -2925,7 +2930,7 @@
   configlist->AddAttribute("defaultConfigurationIsVisible",
                            this->CreateString("0"));
   configlist->AddAttribute("defaultConfigurationName",
- this->CreateString("Debug"));
+ this->CreateString(defaultconfigname));
   cmXCodeObject* buildSettings =
       this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
   const char* osxArch =
(0029059)
David Cole   
2012-04-02 16:01   
Fixed by this commit, just merged to 'next':

  http://public.kitware.com/gitweb?p=cmake.git;a=commitdiff;h=0579fa045c854b732506887cdf3a9a54610748ab [^]

Thanks for the suggested patch!
(0030888)
David Cole   
2012-09-03 16:02   
Closing resolved issues that have not been updated in more than 4 months.