Add support for CMAKE_STATIC_LINKER_FLAGS

Add the content of this variable to the target specific linker flags
as we do with the other CMAKE_*_LINKER_FLAGS variables already.
This commit is contained in:
Patrick Gansterer 2013-04-07 17:39:05 +02:00 committed by Brad King
parent 14bbf8340a
commit 2a43c306fe
2 changed files with 40 additions and 32 deletions

View File

@ -1545,6 +1545,13 @@ void cmLocalGenerator::GetStaticLibraryFlags(std::string& flags,
std::string const& config, std::string const& config,
cmTarget* target) cmTarget* target)
{ {
this->AppendFlags(flags,
this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS"));
if(!config.empty())
{
std::string name = "CMAKE_STATIC_LINKER_FLAGS_" + config;
this->AppendFlags(flags, this->Makefile->GetSafeDefinition(name.c_str()));
}
this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS")); this->AppendFlags(flags, target->GetProperty("STATIC_LIBRARY_FLAGS"));
if(!config.empty()) if(!config.empty())
{ {

View File

@ -1435,38 +1435,39 @@ void cmLocalVisualStudio6Generator
std::string staticLibOptionsRelWithDebInfo; std::string staticLibOptionsRelWithDebInfo;
if(target.GetType() == cmTarget::STATIC_LIBRARY ) if(target.GetType() == cmTarget::STATIC_LIBRARY )
{ {
if(const char* libflags = target.GetProperty("STATIC_LIBRARY_FLAGS")) const char *libflagsGlobal =
{ this->Makefile->GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS");
staticLibOptions = libflags; this->AppendFlags(staticLibOptions, libflagsGlobal);
staticLibOptionsDebug = libflags; this->AppendFlags(staticLibOptionsDebug, libflagsGlobal);
staticLibOptionsRelease = libflags; this->AppendFlags(staticLibOptionsRelease, libflagsGlobal);
staticLibOptionsMinSizeRel = libflags; this->AppendFlags(staticLibOptionsMinSizeRel, libflagsGlobal);
staticLibOptionsRelWithDebInfo = libflags; this->AppendFlags(staticLibOptionsRelWithDebInfo, libflagsGlobal);
}
if(const char* libflagsDebug = this->AppendFlags(staticLibOptionsDebug, this->Makefile->
target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG")) GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_DEBUG"));
{ this->AppendFlags(staticLibOptionsRelease, this->Makefile->
staticLibOptionsDebug += " "; GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_RELEASE"));
staticLibOptionsDebug = libflagsDebug; this->AppendFlags(staticLibOptionsMinSizeRel, this->Makefile->
} GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL"));
if(const char* libflagsRelease = this->AppendFlags(staticLibOptionsRelWithDebInfo, this->Makefile->
target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE")) GetSafeDefinition("CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO"));
{
staticLibOptionsRelease += " "; const char *libflags = target.GetProperty("STATIC_LIBRARY_FLAGS");
staticLibOptionsRelease = libflagsRelease; this->AppendFlags(staticLibOptions, libflags);
} this->AppendFlags(staticLibOptionsDebug, libflags);
if(const char* libflagsMinSizeRel = this->AppendFlags(staticLibOptionsRelease, libflags);
target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL")) this->AppendFlags(staticLibOptionsMinSizeRel, libflags);
{ this->AppendFlags(staticLibOptionsRelWithDebInfo, libflags);
staticLibOptionsMinSizeRel += " ";
staticLibOptionsMinSizeRel = libflagsMinSizeRel; this->AppendFlags(staticLibOptionsDebug,
} target.GetProperty("STATIC_LIBRARY_FLAGS_DEBUG"));
if(const char* libflagsRelWithDebInfo = this->AppendFlags(staticLibOptionsRelease,
target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO")) target.GetProperty("STATIC_LIBRARY_FLAGS_RELEASE"));
{ this->AppendFlags(staticLibOptionsMinSizeRel,
staticLibOptionsRelWithDebInfo += " "; target.GetProperty("STATIC_LIBRARY_FLAGS_MINSIZEREL"));
staticLibOptionsRelWithDebInfo = libflagsRelWithDebInfo; this->AppendFlags(staticLibOptionsRelWithDebInfo,
} target.GetProperty("STATIC_LIBRARY_FLAGS_RELWITHDEBINFO"));
std::string objects; std::string objects;
this->OutputObjects(target, "LIB", objects); this->OutputObjects(target, "LIB", objects);
if(!objects.empty()) if(!objects.empty())