Merge topic 'xcode-6-librarian-flags'

608cf814 Xcode: Fix static library creation for Xcode 6 (#15038)
This commit is contained in:
Brad King 2014-07-29 08:52:17 -04:00 committed by CMake Topic Stage
commit 05d064fec3
2 changed files with 24 additions and 5 deletions

View File

@ -2299,7 +2299,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
} }
} }
buildSettings->AddAttribute("OTHER_LDFLAGS", buildSettings->AddAttribute(this->GetTargetLinkFlagsVar(target),
this->CreateString(extraLinkOptions.c_str())); this->CreateString(extraLinkOptions.c_str()));
buildSettings->AddAttribute("OTHER_REZFLAGS", buildSettings->AddAttribute("OTHER_REZFLAGS",
this->CreateString("")); this->CreateString(""));
@ -2526,6 +2526,22 @@ std::string cmGlobalXCodeGenerator::AddConfigurations(cmXCodeObject* target,
return ""; return "";
} }
//----------------------------------------------------------------------------
const char*
cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(cmTarget const& cmtarget) const
{
if(this->XcodeVersion >= 60 &&
(cmtarget.GetType() == cmTarget::STATIC_LIBRARY ||
cmtarget.GetType() == cmTarget::OBJECT_LIBRARY))
{
return "OTHER_LIBTOOLFLAGS";
}
else
{
return "OTHER_LDFLAGS";
}
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget) const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
{ {
@ -2835,7 +2851,8 @@ void cmGlobalXCodeGenerator
sep = " "; sep = " ";
linkObjs += this->XCodeEscapePath(oi->c_str()); linkObjs += this->XCodeEscapePath(oi->c_str());
} }
this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", this->AppendBuildSettingAttribute(
target, this->GetTargetLinkFlagsVar(*cmtarget),
linkObjs.c_str(), configName); linkObjs.c_str(), configName);
} }
@ -2914,7 +2931,8 @@ void cmGlobalXCodeGenerator
target->AddDependTarget(configName, li->Target->GetName()); target->AddDependTarget(configName, li->Target->GetName());
} }
} }
this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS", this->AppendBuildSettingAttribute(
target, this->GetTargetLinkFlagsVar(*cmtarget),
linkLibs.c_str(), configName); linkLibs.c_str(), configName);
} }
} }

View File

@ -134,6 +134,7 @@ private:
cmXCodeObject* buildPhases); cmXCodeObject* buildPhases);
void ForceLinkerLanguages(); void ForceLinkerLanguages();
void ForceLinkerLanguage(cmTarget& cmtarget); void ForceLinkerLanguage(cmTarget& cmtarget);
const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const;
const char* GetTargetFileType(cmTarget& cmtarget); const char* GetTargetFileType(cmTarget& cmtarget);
const char* GetTargetProductType(cmTarget& cmtarget); const char* GetTargetProductType(cmTarget& cmtarget);
std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget); std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget);