summaryrefslogtreecommitdiffstats
path: root/Source/cmTargetLinkLibrariesCommand.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2006-11-29 16:00:17 (GMT)
committerKen Martin <ken.martin@kitware.com>2006-11-29 16:00:17 (GMT)
commitdaa6d2bc04ff8631559ffcb5141f197cac33e755 (patch)
tree34559ea255e91d274cfa9d38ed7be7f01a906546 /Source/cmTargetLinkLibrariesCommand.cxx
parente9a80cd8a90c3309d32df58b27dcc6e061f5928f (diff)
downloadCMake-daa6d2bc04ff8631559ffcb5141f197cac33e755.zip
CMake-daa6d2bc04ff8631559ffcb5141f197cac33e755.tar.gz
CMake-daa6d2bc04ff8631559ffcb5141f197cac33e755.tar.bz2
ENH: updated handling of debug and optimized target link libraries
Diffstat (limited to 'Source/cmTargetLinkLibrariesCommand.cxx')
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx37
1 files changed, 35 insertions, 2 deletions
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index af5ecb1..2b649b1 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -62,10 +62,43 @@ bool cmTargetLinkLibrariesCommand::InitialPass(std::vector<std::string>
this->Makefile->AddLinkLibraryForTarget(args[0].c_str(),i->c_str(),
cmTarget::OPTIMIZED);
}
- else
+ 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);
+ cmTarget::GENERAL);
+ }
+ else
+ {
+ // 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;