ENH: do not always add -arch flags
This commit is contained in:
parent
4168c0797b
commit
613c35e033
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -1941,6 +1941,22 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
|||
std::vector<std::string> archs;
|
||||
cmSystemTools::ExpandListArgument(std::string(osxArch),
|
||||
archs);
|
||||
bool addArchFlag = true;
|
||||
if(archs.size() == 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -1951,6 +1967,7 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
|
|||
flags += sysroot;
|
||||
}
|
||||
}
|
||||
}
|
||||
this->AddConfigVariableFlags(flags, flagsVar.c_str(), config);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue