summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2007-10-20 02:24:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2007-10-20 02:24:00 (GMT)
commit613c35e033ce8d2ae2c1c8e12af775e277039f67 (patch)
tree96114a84e513c071526cc892e19d483caaad6b0c
parent4168c0797bdc3e6c2ff6cdd40bd1099edc5a0c96 (diff)
downloadCMake-613c35e033ce8d2ae2c1c8e12af775e277039f67.zip
CMake-613c35e033ce8d2ae2c1c8e12af775e277039f67.tar.gz
CMake-613c35e033ce8d2ae2c1c8e12af775e277039f67.tar.bz2
ENH: do not always add -arch flags
-rw-r--r--Modules/Platform/Darwin.cmake1
-rw-r--r--Source/cmLocalGenerator.cxx29
2 files changed, 24 insertions, 6 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 5f14228..348abfc 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -44,6 +44,7 @@ IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
# now put _CMAKE_OSX_MACHINE into the cache
SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE}
CACHE STRING "Build architectures for OSX")
+ SET(CMAKE_OSX_ARCHITECTURES_DEFAULT ${_CMAKE_OSX_MACHINE})
ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index acaaad5..1e9c55a 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1941,14 +1941,31 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
std::vector<std::string> archs;
cmSystemTools::ExpandListArgument(std::string(osxArch),
archs);
- for( std::vector<std::string>::iterator i = archs.begin();
- i != archs.end(); ++i)
+ bool addArchFlag = true;
+ if(archs.size() == 1)
{
- flags += " -arch ";
- flags += *i;
+ const char* archOrig =
+ this->Makefile->GetSafeDefinition("CMAKE_OSX_ARCHITECTURE_DEFAULT");
+ if(archs[0] == archOrig)
+ {
+ addArchFlag = false;
+ }
+ }
+ // if there is more than one arch add the -arch and
+ // -isysroot flags, or if there is one arch flag, but
+ // it is not the default -arch flag for the system, then
+ // add it. Otherwize do not add -arch and -isysroot
+ if(addArchFlag)
+ {
+ for( std::vector<std::string>::iterator i = archs.begin();
+ i != archs.end(); ++i)
+ {
+ flags += " -arch ";
+ flags += *i;
+ }
+ flags += " -isysroot ";
+ flags += sysroot;
}
- flags += " -isysroot ";
- flags += sysroot;
}
}
this->AddConfigVariableFlags(flags, flagsVar.c_str(), config);