ENH: Add target property LINK_SEARCH_END_STATIC to help people building static binaries on some platforms.

This commit is contained in:
Brad King 2008-01-31 08:05:34 -05:00
parent 3a05425309
commit afd7d4ca4c
2 changed files with 21 additions and 1 deletions

View File

@ -340,7 +340,15 @@ bool cmComputeLinkInformation::Compute()
// Restore the target link type so the correct system runtime // Restore the target link type so the correct system runtime
// libraries are found. // libraries are found.
this->SetCurrentLinkType(this->StartLinkType); const char* lss = this->Target->GetProperty("LINK_SEARCH_END_STATIC");
if(cmSystemTools::IsOn(lss))
{
this->SetCurrentLinkType(LinkStatic);
}
else
{
this->SetCurrentLinkType(this->StartLinkType);
}
// Compute the linker search path. // Compute the linker search path.
this->ComputeLinkerSearchDirectories(); this->ComputeLinkerSearchDirectories();

View File

@ -284,6 +284,18 @@ void cmTarget::DefineProperties(cmake *cm)
"Per-configuration linker flags for a target.", "Per-configuration linker flags for a target.",
"This is the configuration-specific version of LINK_FLAGS."); "This is the configuration-specific version of LINK_FLAGS.");
cm->DefineProperty
("LINK_SEARCH_END_STATIC", cmProperty::TARGET,
"End a link line such that static system libraries are used.",
"Some linkers support switches such as -Bstatic and -Bdynamic "
"to determine whether to use static or shared libraries for -lXXX "
"options. CMake uses these options to set the link type for "
"libraries whose full paths are not known or (in some cases) are in "
"implicit link directories for the platform. By default the "
"linker search type is left at -Bdynamic by the end of the library "
"list. This property switches the final linker search type to "
"-Bstatic.");
cm->DefineProperty cm->DefineProperty
("LINKER_LANGUAGE", cmProperty::TARGET, ("LINKER_LANGUAGE", cmProperty::TARGET,
"What tool to use for linking, based on language.", "What tool to use for linking, based on language.",