Merge topic 'xcode-default-ARCHS'

b76b52c0 Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736)
9e14a5de cmGlobalXCodeGenerator: Simplify ARCHS list with cmJoin
This commit is contained in:
Brad King 2015-03-30 09:27:47 -04:00 committed by CMake Topic Stage
commit ac6297ea38
2 changed files with 21 additions and 41 deletions

View File

@ -79,7 +79,6 @@
1DEB928A08733DD80010E9CD = { 1DEB928A08733DD80010E9CD = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
CODE_SIGNING_REQUIRED = NO; CODE_SIGNING_REQUIRED = NO;
CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";

View File

@ -21,6 +21,7 @@
#include "cmCustomCommandGenerator.h" #include "cmCustomCommandGenerator.h"
#include "cmGeneratorTarget.h" #include "cmGeneratorTarget.h"
#include "cmGlobalGeneratorFactory.h" #include "cmGlobalGeneratorFactory.h"
#include "cmAlgorithms.h"
#include <cmsys/auto_ptr.hxx> #include <cmsys/auto_ptr.hxx>
@ -3380,53 +3381,33 @@ bool cmGlobalXCodeGenerator
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP); this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
const char* osxArch = const char* osxArch =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); 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 = const char* sysroot =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
const char* deploymentTarget = const char* deploymentTarget =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); 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 if(osxArch)
this->Architectures.clear(); {
cmSystemTools::ExpandListArgument(std::string(osxArch), // recompute this as it may have been changed since enable language
this->Architectures); this->Architectures.clear();
cmSystemTools::ExpandListArgument(std::string(osxArch),
this->Architectures);
archs = cmJoin(this->Architectures, " ");
}
buildSettings->AddAttribute("SDKROOT", buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot)); this->CreateString(sysroot));
std::string archString; }
const char* sep = ""; if (archs.empty())
for( std::vector<std::string>::iterator i = {
this->Architectures.begin(); // Tell Xcode to use NATIVE_ARCH instead of ARCHS.
i != this->Architectures.end(); ++i) buildSettings->AddAttribute("ONLY_ACTIVE_ARCH", this->CreateString("YES"));
{ }
archString += sep; else
archString += *i; {
sep = " "; // Tell Xcode to use ARCHS (ONLY_ACTIVE_ARCH defaults to NO).
} buildSettings->AddAttribute("ARCHS", this->CreateString(archs.c_str()));
buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str()));
} }
if(deploymentTarget && *deploymentTarget) if(deploymentTarget && *deploymentTarget)
{ {