diff options
author | Brad King <brad.king@kitware.com> | 2017-04-05 17:33:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-11 15:40:15 (GMT) |
commit | 5b29fd6d4df4eea8ac04a3f6287f721e28b6b5b4 (patch) | |
tree | fb0197003d6340284ad658e4f5fdf69bf50de02e | |
parent | b1eb493c11f38f651c2a8f0489918f3a55feeb99 (diff) | |
download | CMake-5b29fd6d4df4eea8ac04a3f6287f721e28b6b5b4.zip CMake-5b29fd6d4df4eea8ac04a3f6287f721e28b6b5b4.tar.gz CMake-5b29fd6d4df4eea8ac04a3f6287f721e28b6b5b4.tar.bz2 |
Xcode: Refactor internal architecture list construction
Factor population of the `Architectures` member out into a helper to
avoid duplication.
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 32 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.h | 2 |
2 files changed, 17 insertions, 17 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index febe95d..cbad52c 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -282,13 +282,7 @@ void cmGlobalXCodeGenerator::EnableLanguage( } mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); - const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); - const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); - if (osxArch && sysroot) { - this->Architectures.clear(); - cmSystemTools::ExpandListArgument(std::string(osxArch), - this->Architectures); - } + this->ComputeArchitectures(mf); } void cmGlobalXCodeGenerator::GenerateBuildCommand( @@ -3089,23 +3083,16 @@ bool cmGlobalXCodeGenerator::CreateXCodeObjects( this->CreateString(defaultConfigName)); cmXCodeObject* buildSettings = this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); - const char* osxArch = - this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - std::string archs; if (sysroot) { - if (osxArch) { - // recompute this as it may have been changed since enable language - this->Architectures.clear(); - cmSystemTools::ExpandListArgument(std::string(osxArch), - this->Architectures); - archs = cmJoin(this->Architectures, " "); - } buildSettings->AddAttribute("SDKROOT", this->CreateString(sysroot)); } + // recompute this as it may have been changed since enable language + this->ComputeArchitectures(this->CurrentMakefile); + std::string const archs = cmJoin(this->Architectures, " "); if (archs.empty()) { // Tell Xcode to use NATIVE_ARCH instead of ARCHS. buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); @@ -3212,6 +3199,17 @@ std::string cmGlobalXCodeGenerator::GetObjectsNormalDirectory( return dir; } +void cmGlobalXCodeGenerator::ComputeArchitectures(cmMakefile* mf) +{ + this->Architectures.clear(); + const char* osxArch = mf->GetDefinition("CMAKE_OSX_ARCHITECTURES"); + const char* sysroot = mf->GetDefinition("CMAKE_OSX_SYSROOT"); + if (osxArch && sysroot) { + cmSystemTools::ExpandListArgument(std::string(osxArch), + this->Architectures); + } +} + void cmGlobalXCodeGenerator::CreateXCodeDependHackTarget( std::vector<cmXCodeObject*>& targets) { diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index 172e414..beb789b 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -240,6 +240,8 @@ private: const std::string& configName, const cmGeneratorTarget* t) const; + void ComputeArchitectures(cmMakefile* mf); + void addObject(cmXCodeObject* obj); std::string PostBuildMakeTarget(std::string const& tName, std::string const& configName); |