diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2008-04-28 17:53:14 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2008-04-28 17:53:14 (GMT) |
commit | d4fdbeed6442d4df507d5fe4045435afc698fc96 (patch) | |
tree | b13b5392de566b91b79ae1dfe323b03afbd1db9e /Source | |
parent | 9bc893eb161b66c3afb5c3547c64009336654535 (diff) | |
download | CMake-d4fdbeed6442d4df507d5fe4045435afc698fc96.zip CMake-d4fdbeed6442d4df507d5fe4045435afc698fc96.tar.gz CMake-d4fdbeed6442d4df507d5fe4045435afc698fc96.tar.bz2 |
ENH: allow users to set sysroot
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGlobalXCodeGenerator.cxx | 23 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 12 |
2 files changed, 33 insertions, 2 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 33820aa..3e31a42 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2451,14 +2451,29 @@ void cmGlobalXCodeGenerator this->CurrentMakefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT"); + const char* sysrootDefault = + this->CurrentMakefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); if(osxArch && sysroot) { + bool flagsUsed = false; // recompute this as it may have been changed since enable language this->Architectures.clear(); cmSystemTools::ExpandListArgument(std::string(osxArch), this->Architectures); - if(this->Architectures.size() > 1) + 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; @@ -2472,6 +2487,12 @@ void cmGlobalXCodeGenerator buildSettings->AddAttribute("ARCHS", this->CreateString(archString.c_str())); } + if(!flagsUsed && sysrootDefault && + strcmp(sysroot, sysrootDefault) != 0) + { + buildSettings->AddAttribute("SDKROOT", + this->CreateString(sysroot)); + } } for( std::vector<cmXCodeObject*>::iterator i = configs.begin(); i != configs.end(); ++i) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index d806978..0a03028 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1627,6 +1627,9 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, this->Makefile->GetDefinition("CMAKE_OSX_ARCHITECTURES"); const char* sysroot = this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT"); + const char* sysrootDefault = + this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT"); + bool flagsUsed = false; if(osxArch && sysroot && lang && lang[0] =='C') { std::vector<std::string> archs; @@ -1656,10 +1659,17 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags, } flags += " -isysroot "; flags += sysroot; + flagsUsed = true; } } + if(!flagsUsed && sysroot && sysrootDefault && + strcmp(sysroot, sysrootDefault) != 0) + { + flags += " -isysroot "; + flags += sysroot; + } + this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); } - this->AddConfigVariableFlags(flags, flagsVar.c_str(), config); } //---------------------------------------------------------------------------- |