From 0883dee7f039fbad43fb237cafdcf09796ed6199 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Tue, 16 May 2006 09:54:49 -0400 Subject: ENH: fix rebuild problem with xcode and universal binaries --- Source/cmGlobalXCodeGenerator.cxx | 38 ++++++++++++++++++++++++++++++++------ Source/cmGlobalXCodeGenerator.h | 1 + 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 536229a..4a1d673 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2145,16 +2145,17 @@ void cmGlobalXCodeGenerator this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); if(osxArch && sysroot) { - std::vector 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::iterator i = archs.begin(); - i != archs.end(); ++i) + for( std::vector::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::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"; } } diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 669942a..326bfd0 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -182,6 +182,7 @@ private: std::map GroupMap; std::map GroupNameMap; std::map TargetGroup; + std::vector Architectures; }; #endif -- cgit v0.12