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 += " ";
}
if(!buildType.empty())
{
std::string build = "STATIC_LIBRARY_FLAGS_";
build += buildType;
targetLinkFlags = target.GetProperty(build.c_str());
if(targetLinkFlags)
{
linkFlags += targetLinkFlags;
linkFlags += " ";
}
}
}
break;
case cmTarget::MODULE_LIBRARY:
@ -1471,7 +1482,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
if(buildType.size())
if(!buildType.empty())
{
std::string build = libraryLinkVariable;
build += "_";
@ -1502,7 +1513,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags += targetLinkFlags;
linkFlags += " ";
std::string configLinkFlags = targetLinkFlags;
}
if(!buildType.empty())
{
std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
@ -1521,7 +1535,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
if(buildType.size())
if(!buildType.empty())
{
std::string build = "CMAKE_EXE_LINKER_FLAGS_";
build += buildType;
@ -1574,7 +1588,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags += targetLinkFlags;
linkFlags += " ";
std::string configLinkFlags = targetLinkFlags;
}
if(!buildType.empty())
{
std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)