diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2009-09-17 15:53:02 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2009-09-17 15:53:02 (GMT) |
commit | ea282284d5d626b1143bea8d3be70995eaa88f2e (patch) | |
tree | 8ac5f12977743e8caa4d2850fa5bff9d0ca3fe79 | |
parent | 8e8c9b72428ab3f4a63a99820dfd4aab46661bd6 (diff) | |
download | CMake-ea282284d5d626b1143bea8d3be70995eaa88f2e.zip CMake-ea282284d5d626b1143bea8d3be70995eaa88f2e.tar.gz CMake-ea282284d5d626b1143bea8d3be70995eaa88f2e.tar.bz2 |
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.
-rw-r--r-- | Modules/Platform/Darwin.cmake | 6 | ||||
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 54 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 5 |
3 files changed, 29 insertions, 36 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index b0179f4..825f218 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -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 diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 4131dfc..cf60bd9 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -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) - { - 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())); - } + 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())); if(!flagsUsed && sysrootDefault && strcmp(sysroot, sysrootDefault) != 0) { diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4d7bfdb..9338706 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -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; } |