ENH: updated handling of debug and optimized target link libraries

This commit is contained in:
Ken Martin
2006-11-29 11:00:17 -05:00
parent e9a80cd8a9
commit daa6d2bc04
5 changed files with 113 additions and 136 deletions
+35 -2
View File
@@ -62,10 +62,43 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string>
this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),
cmTarget::OPTIMIZED);
}
else if (*i == "general")
{
++i;
if(i == args.end())
{
this->SetError(
"The \"general\" argument must be followed by a library");
return false;
}
this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),
cmTarget::GENERAL);
}
else
{
this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),
cmTarget::GENERAL);
// make sure the type is correct if it is currently general. So if you
// do a target_link_libraries(foo optimized bar) it will stay optimized
// and not use the lookup. As there maybe the case where someone has
// specifed that a library is both debug and optimized. (this check is
// only there for backwards compatibility when mixing projects built
// with old versions of CMake and new)
cmTarget::LinkLibraryType llt = cmTarget::GENERAL;
std::string linkType = args[0];
linkType += "_LINK_TYPE";
const char* linkTypeString =
this->Makefile->GetDefinition( linkType.c_str() );
if(linkTypeString)
{
if(strcmp(linkTypeString, "debug") == 0)
{
llt = cmTarget::DEBUG;
}
if(strcmp(linkTypeString, "optimized") == 0)
{
llt = cmTarget::OPTIMIZED;
}
}
this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),llt);
}
}
return true;