mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-29 10:39:28 -05:00
ENH: updated handling of debug and optimized target link libraries
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user