summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefile.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-05-02 17:17:10 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-05-02 17:17:10 (GMT)
commit27fe57b716555ffa31b16e98841c7f1a82228740 (patch)
tree361f44d30ef7bdba9c37b389824ac9670801177e /Source/cmMakefile.cxx
parentb5b46599feb33d7f873faca6215f1717ddd209e6 (diff)
downloadCMake-27fe57b716555ffa31b16e98841c7f1a82228740.zip
CMake-27fe57b716555ffa31b16e98841c7f1a82228740.tar.gz
CMake-27fe57b716555ffa31b16e98841c7f1a82228740.tar.bz2
ENH: change LINK_LIBRARY to add to targets
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r--Source/cmMakefile.cxx48
1 files changed, 43 insertions, 5 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 9280cf2..4c31efa 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -428,8 +428,6 @@ void cmMakefile::GenerateMakefile()
l != m_Targets.end(); l++)
{
l->second.GenerateSourceFilesFromSourceLists(*this);
- l->second.MergeLibraries(m_LinkLibraries);
- l->second.MergeDirectories(m_LinkDirectories);
l->second.AnalyzeLibDependencies(*this);
}
// now do the generation
@@ -520,10 +518,11 @@ void cmMakefile::AddLinkLibrary(const char* lib, cmTarget::LinkLibraryType llt)
void cmMakefile::AddLinkLibraryForTarget(const char *target,
const char* lib,
cmTarget::LinkLibraryType llt)
-{
- if (m_Targets.find(target) != m_Targets.end())
+{
+ cmTargets::iterator i = m_Targets.find(target);
+ if ( i != m_Targets.end())
{
- m_Targets[target].AddLinkLibrary( *this, target, lib, llt );
+ i->second.AddLinkLibrary( *this, target, lib, llt );
}
else
{
@@ -531,6 +530,21 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
}
}
+void cmMakefile::AddLinkDirectoryForTarget(const char *target,
+ const char* d)
+{
+ cmTargets::iterator i = m_Targets.find(target);
+ if ( i != m_Targets.end())
+ {
+ i->second.AddLinkDirectory( d );
+ }
+ else
+ {
+ cmSystemTools::Error("Attempt to add link directories to non-existant target: ",
+ target, " for directory ", d);
+ }
+}
+
void cmMakefile::AddLinkLibrary(const char* lib)
{
this->AddLinkLibrary(lib,cmTarget::GENERAL);
@@ -654,7 +668,20 @@ void cmMakefile::AddLibrary(const char* lname, int shared,
target.SetInAll(true);
target.GetSourceLists() = srcs;
+ std::vector<std::string>::iterator j;
+ for(j = m_LinkDirectories.begin();
+ j != m_LinkDirectories.end(); ++j)
+ {
+ target.AddLinkDirectory(j->c_str());
+ }
m_Targets.insert(cmTargets::value_type(lname,target));
+ cmTarget::LinkLibraries::iterator i;
+ for(i = m_LinkLibraries.begin(); i != m_LinkLibraries.end(); ++i)
+ {
+ this->AddLinkLibraryForTarget(lname, i->first.c_str(), i->second);
+ }
+
+
// Add an entry into the cache
cmCacheManager::GetInstance()->
@@ -727,7 +754,18 @@ void cmMakefile::AddExecutable(const char *exeName,
}
target.SetInAll(true);
target.GetSourceLists() = srcs;
+ std::vector<std::string>::iterator j;
+ for(j = m_LinkDirectories.begin();
+ j != m_LinkDirectories.end(); ++j)
+ {
+ target.AddLinkDirectory(j->c_str());
+ }
m_Targets.insert(cmTargets::value_type(exeName,target));
+ cmTarget::LinkLibraries::iterator i;
+ for(i = m_LinkLibraries.begin(); i != m_LinkLibraries.end(); ++i)
+ {
+ this->AddLinkLibraryForTarget(exeName, i->first.c_str(), i->second);
+ }
// Add an entry into the cache
cmCacheManager::GetInstance()->