Fix for bug #9466. Change the implementation of OSX arch lists. If no ARCHs are specified by the user then no flags are set. We no longer use CMAKE_OSX_ARCHITECTURES_DEFAULT.

This commit is contained in:
Bill Hoffman 2009-09-17 11:53:02 -04:00
parent 8e8c9b7242
commit ea282284d5
3 changed files with 27 additions and 34 deletions

View File

@ -149,16 +149,12 @@ IF(_CMAKE_OSX_MACHINE MATCHES "Power")
SET(_CMAKE_OSX_MACHINE ppc)
ENDIF(_CMAKE_OSX_MACHINE MATCHES "Power")
# set the default based on uname and not the environment variable
# as that is what is used to change it!
SET(CMAKE_OSX_ARCHITECTURES_DEFAULT ${_CMAKE_OSX_MACHINE})
# check for environment variable CMAKE_OSX_ARCHITECTURES
# if it is set.
IF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
SET(CMAKE_OSX_ARCHITECTURES_VALUE "$ENV{CMAKE_OSX_ARCHITECTURES}")
ELSE(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
SET(CMAKE_OSX_ARCHITECTURES_VALUE ${CMAKE_OSX_ARCHITECTURES_DEFAULT})
SET(CMAKE_OSX_ARCHITECTURES_VALUE "")
ENDIF(NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
# now put _CMAKE_OSX_MACHINE into the cache

View File

@ -2675,6 +2675,20 @@ void cmGlobalXCodeGenerator
this->CreateObject(cmXCodeObject::ATTRIBUTE_GROUP);
const char* osxArch =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES");
if(strlen(osxArch) == 0)
{
if(this->XcodeVersion >= 32)
{
osxArch = "$(ARCHS_STANDARD_32_64_BIT)";
}
else
{
osxArch = "$(ARCHS_STANDARD_32_BIT)";
}
buildSettings->AddAttribute("ONLY_ACTIVE_ARCH",
this->CreateString("YES"));
}
const char* sysroot =
this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT");
const char* sysrootDefault =
@ -2688,33 +2702,19 @@ void cmGlobalXCodeGenerator
this->Architectures.clear();
cmSystemTools::ExpandListArgument(std::string(osxArch),
this->Architectures);
bool addArchFlag = true;
if(this->Architectures.size() == 1)
flagsUsed = true;
buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot));
std::string archString;
for( std::vector<std::string>::iterator i =
this->Architectures.begin();
i != this->Architectures.end(); ++i)
{
const char* archOrig =
this->
CurrentMakefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES_DEFAULT");
if(this->Architectures[0] == archOrig)
{
addArchFlag = false;
}
}
if(addArchFlag)
{
flagsUsed = true;
buildSettings->AddAttribute("SDKROOT",
this->CreateString(sysroot));
std::string archString;
for( std::vector<std::string>::iterator i =
this->Architectures.begin();
i != this->Architectures.end(); ++i)
{
archString += *i;
archString += " ";
}
buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str()));
archString += *i;
archString += " ";
}
buildSettings->AddAttribute("ARCHS",
this->CreateString(archString.c_str()));
if(!flagsUsed && sysrootDefault &&
strcmp(sysroot, sysrootDefault) != 0)
{

View File

@ -1770,10 +1770,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
bool addArchFlag = true;
if(archs.size() == 1)
{
const char* archOrig =
this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURES_DEFAULT");
if(archs[0] == archOrig)
if(archs[0] == "")
{
addArchFlag = false;
}