Fix configuration-dependent flag lookup in cmLocalGenerator::GetTargetFlags

Specifically, perform configuration-dependent lookup of
STATIC_LIBRARY_FLAGS for static libraries, and use the correct prefix
for configuration-dependent lookup of LINK_FLAGS (i.e. "LINK_FLAGS_",
as opposed to the value of the LINK_FLAGS property).
This commit is contained in:
Peter Collingbourne 2011-09-22 03:59:55 +01:00
parent 557956f348
commit fec4b63714
1 changed files with 22 additions and 5 deletions

View File

@ -1463,6 +1463,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += targetLinkFlags; linkFlags += targetLinkFlags;
linkFlags += " "; linkFlags += " ";
} }
if(!buildType.empty())
{
std::string build = "STATIC_LIBRARY_FLAGS_";
build += buildType;
targetLinkFlags = target.GetProperty(build.c_str());
if(targetLinkFlags)
{
linkFlags += targetLinkFlags;
linkFlags += " ";
}
}
} }
break; break;
case cmTarget::MODULE_LIBRARY: case cmTarget::MODULE_LIBRARY:
@ -1471,7 +1482,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{ {
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable); linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " "; linkFlags += " ";
if(buildType.size()) if(!buildType.empty())
{ {
std::string build = libraryLinkVariable; std::string build = libraryLinkVariable;
build += "_"; build += "_";
@ -1502,7 +1513,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{ {
linkFlags += targetLinkFlags; linkFlags += targetLinkFlags;
linkFlags += " "; linkFlags += " ";
std::string configLinkFlags = targetLinkFlags; }
if(!buildType.empty())
{
std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType; configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags) if(targetLinkFlags)
@ -1521,7 +1535,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS"); this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " "; linkFlags += " ";
if(buildType.size()) if(!buildType.empty())
{ {
std::string build = "CMAKE_EXE_LINKER_FLAGS_"; std::string build = "CMAKE_EXE_LINKER_FLAGS_";
build += buildType; build += buildType;
@ -1573,8 +1587,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
if(targetLinkFlags) if(targetLinkFlags)
{ {
linkFlags += targetLinkFlags; linkFlags += targetLinkFlags;
linkFlags += " "; linkFlags += " ";
std::string configLinkFlags = targetLinkFlags; }
if(!buildType.empty())
{
std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType; configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags) if(targetLinkFlags)