ENH: fix rebuild problem with xcode and universal binaries

This commit is contained in:
Bill Hoffman 2006-05-16 09:54:49 -04:00
parent 70d8c0f3d8
commit 0883dee7f0
2 changed files with 33 additions and 6 deletions

View File

@ -2145,16 +2145,17 @@ void cmGlobalXCodeGenerator
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
if(osxArch && sysroot) if(osxArch && sysroot)
{ {
std::vector<std::string> archs; this->Architectures.clear();
cmSystemTools::ExpandListArgument(std::string(osxArch), cmSystemTools::ExpandListArgument(std::string(osxArch),
archs); this->Architectures);
if(archs.size() > 1) if(this->Architectures.size() > 1)
{ {
buildSettings->AddAttribute("SDKROOT", buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot)); this->CreateString(sysroot));
std::string archString; std::string archString;
for( std::vector<std::string>::iterator i = archs.begin(); for( std::vector<std::string>::iterator i =
i != archs.end(); ++i) this->Architectures.begin();
i != this->Architectures.end(); ++i)
{ {
archString += *i; archString += *i;
archString += " "; archString += " ";
@ -2326,12 +2327,37 @@ cmGlobalXCodeGenerator::CreateXCodeDependHackTarget(
this->ConvertToRelativeForMake(d->c_str()); this->ConvertToRelativeForMake(d->c_str());
} }
} }
// Write the action to remove the target if it is out of date. // Write the action to remove the target if it is out of date.
makefileStream << "\n"; makefileStream << "\n";
makefileStream << "\t/bin/rm -f " makefileStream << "\t/bin/rm -f "
<< this->ConvertToRelativeForMake(tfull.c_str()) << this->ConvertToRelativeForMake(tfull.c_str())
<< "\n"; << "\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"; makefileStream << "\n\n";
} }
} }

View File

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