diff options
author | Brad King <brad.king@kitware.com> | 2015-03-30 13:27:47 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-03-30 13:27:47 (GMT) |
commit | ac6297ea3859ff552bce76f68110afc2e9678d9c (patch) | |
tree | e6911d4fdfa3fda0a263ec07019b5c58cf62f9fe /Source | |
parent | 136a534f7242e7a0352763158c4807b616860df8 (diff) | |
parent | b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 (diff) | |
download | CMake-ac6297ea3859ff552bce76f68110afc2e9678d9c.zip CMake-ac6297ea3859ff552bce76f68110afc2e9678d9c.tar.gz CMake-ac6297ea3859ff552bce76f68110afc2e9678d9c.tar.bz2 |
Merge topic 'xcode-default-ARCHS'
b76b52c0 Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736)
9e14a5de cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 61 |
1 files changed, 21 insertions, 40 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d340e72..f139ad1 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -21,6 +21,7 @@ #include "cmCustomCommandGenerator.h" #include "cmGeneratorTarget.h" #include "cmGlobalGeneratorFactory.h" +#include "cmAlgorithms.h" #include <cmsys/auto_ptr.hxx> @@ -3380,53 +3381,33 @@ bool cmGlobalXCodeGenerator this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); const char* osxArch = this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); - if(!osxArch || strlen(osxArch) == 0) - { - if(this->XcodeVersion >= 32) - { - osxArch = "$(ARCHS_STANDARD_32_64_BIT)"; - } - else if(this->XcodeVersion == 31) - { - osxArch = "$(ARCHS_STANDARD_32_BIT)"; - } - else if(this->XcodeVersion <= 30) - { -#ifdef __ppc__ - osxArch = "ppc"; -#endif -#ifdef __i386 - osxArch = "i386"; -#endif - } - buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", - this->CreateString("YES")); - } - const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); const char* deploymentTarget = this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); - if(osxArch && sysroot) + std::string archs; + if(sysroot) { - // recompute this as it may have been changed since enable language - this->Architectures.clear(); - cmSystemTools::ExpandListArgument(std::string(osxArch), - this->Architectures); - buildSettings->AddAttribute("SDKROOT", - this->CreateString(sysroot)); - std::string archString; - const char* sep = ""; - for( std::vector<std::string>::iterator i = - this->Architectures.begin(); - i != this->Architectures.end(); ++i) + if(osxArch) { - archString += sep; - archString += *i; - sep = " "; + // 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("ARCHS", - this->CreateString(archString.c_str())); + buildSettings->AddAttribute("SDKROOT", + this->CreateString(sysroot)); + } + if (archs.empty()) + { + // Tell Xcode to use NATIVE_ARCH instead of ARCHS. + buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES")); + } + else + { + // Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO). + buildSettings->AddAttribute("ARCHS", this->CreateString(archs.c_str())); } if(deploymentTarget && *deploymentTarget) { |