diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-03-24 14:15:05 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-03-24 14:15:05 (GMT) |
commit | f7c1723135f140eaac1ee02c31c0339761778f22 (patch) | |
tree | ae4858167f38f2e57c3dcf442fbfe83aeea1cc82 /Source/cmLocalGenerator.cxx | |
parent | cec6543d0d7e0f8302b092f3ff66fb240bc212c4 (diff) | |
download | CMake-f7c1723135f140eaac1ee02c31c0339761778f22.zip CMake-f7c1723135f140eaac1ee02c31c0339761778f22.tar.gz CMake-f7c1723135f140eaac1ee02c31c0339761778f22.tar.bz2 |
ENH: add support for universal binaries
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r-- | Source/cmLocalGenerator.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 7a97cb4..82d4d03 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -40,6 +40,7 @@ cmLocalGenerator::cmLocalGenerator() this->IgnoreLibPrefix = false; this->UseRelativePaths = false; this->Configured = false; + this->EmitUniversalBinaryFlags = true; } cmLocalGenerator::~cmLocalGenerator() @@ -1378,6 +1379,30 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, std::string flagsVar = "CMAKE_"; flagsVar += lang; flagsVar += "_FLAGS"; + if(this->EmitUniversalBinaryFlags) + { + const char* osxArch = + this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); + const char* sysroot = + this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + if(osxArch && sysroot && lang && lang[0] =='C') + { + std::vector<std::string> archs; + cmSystemTools::ExpandListArgument(std::string(osxArch), + archs); + if(archs.size() > 1) + { + for( std::vector<std::string>::iterator i = archs.begin(); + i != archs.end(); ++i) + { + flags += " -arch "; + flags += *i; + } + flags += " -isysroot "; + flags += sysroot; + } + } + } this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); } @@ -1472,7 +1497,6 @@ void cmLocalGenerator::AddConfigVariableFlags(std::string& flags, // Add the flags from the variable itself. std::string flagsVar = var; this->AppendFlags(flags, this->Makefile->GetDefinition(flagsVar.c_str())); - // Add the flags from the build-type specific variable. if(config && *config) { |