summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-27 14:46:11 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-27 14:52:32 (GMT)
commitb76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87 (patch)
treecc512a428379867c425f8ff5b95ee86493a70e7c /Source
parent9e14a5dee2b7ec420fcfea49c2f2f41da84e2cbf (diff)
downloadCMake-b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87.zip
CMake-b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87.tar.gz
CMake-b76b52c0b4b2f1cd324d6e93d26911e3bc4a8b87.tar.bz2
Xcode: Set ARCHS only when CMAKE_OSX_ARCHITECTURES is specified (#14736)
Teach the Xcode generator that ONLY_ACTIVE_ARCH=YES means to use ARCHS, and that the default of ONLY_ACTIVE_ARCH=NO means to use NATIVE_ARCH and ignore ARCHS. In the latter case there is no reason to generate ARCHS.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx51
1 files changed, 20 insertions, 31 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 447f975..f139ad1 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -3381,44 +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);
+ 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));
- std::string const& archString = cmJoin(this->Architectures, " ");
- buildSettings->AddAttribute("ARCHS",
- this->CreateString(archString.c_str()));
+ }
+ 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)
{