Browse Source

ENH: fix rebuild problem with xcode and universal binaries

Bill Hoffman 19 years ago
parent
commit
0883dee7f0
2 changed files with 33 additions and 6 deletions
  1. 32 6
      Source/cmGlobalXCodeGenerator.cxx
  2. 1 0
      Source/cmGlobalXCodeGenerator.h

+ 32 - 6
Source/cmGlobalXCodeGenerator.cxx

@@ -2145,16 +2145,17 @@ void cmGlobalXCodeGenerator
       this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
   if(osxArch && sysroot)
     {
-    std::vector<std::string> archs;
+    this->Architectures.clear();
     cmSystemTools::ExpandListArgument(std::string(osxArch),
-                                      archs);
-    if(archs.size() > 1)
+                                      this->Architectures);
+    if(this->Architectures.size() > 1)
       {
       buildSettings->AddAttribute("SDKROOT", 
                                   this->CreateString(sysroot));
       std::string archString;
-      for( std::vector<std::string>::iterator i = archs.begin();
-           i != archs.end(); ++i)
+      for( std::vector<std::string>::iterator i = 
+             this->Architectures.begin();
+           i != this->Architectures.end(); ++i)
         {
         archString += *i;
         archString += " ";
@@ -2326,12 +2327,37 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
               this->ConvertToRelativeForMake(d->c_str());
             }
           }
-
         // Write the action to remove the target if it is out of date.
         makefileStream << "\n";
         makefileStream << "\t/bin/rm -f "
                        << this->ConvertToRelativeForMake(tfull.c_str())
                        << "\n";
+        // if building for more than one architecture
+        // then remove those exectuables as well
+        if(this->Architectures.size() > 1)
+          {
+          std::string universal = t->GetDirectory();
+          universal += "/";
+          universal += this->CurrentMakefile->GetProjectName();
+          universal += ".build/";
+          universal += configName;
+          universal += "/";
+          universal += t->GetName();
+          universal += ".build/Objects-normal/";
+          for( std::vector<std::string>::iterator i = 
+                 this->Architectures.begin();
+               i != this->Architectures.end(); ++i)
+            {
+            std::string universalFile = universal;
+            universalFile += *i;
+            universalFile += "/";
+            universalFile += t->GetName();
+            makefileStream << "\t/bin/rm -f "
+                           << 
+              this->ConvertToRelativeForMake(universalFile.c_str())
+                           << "\n";
+            }
+          }
         makefileStream << "\n\n";
         }
       }

+ 1 - 0
Source/cmGlobalXCodeGenerator.h

@@ -182,6 +182,7 @@ private:
   std::map<cmSourceFile*, cmXCodeObject* > GroupMap;
   std::map<cmStdString, cmXCodeObject* > GroupNameMap;
   std::map<cmStdString, cmXCodeObject* > TargetGroup;
+  std::vector<std::string> Architectures;
 };
 
 #endif