summaryrefslogtreecommitdiffstats
path: root/Source/cmOrderLinkDirectories.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-01-13 23:18:32 (GMT)
committerBrad King <brad.king@kitware.com>2006-01-13 23:18:32 (GMT)
commit22c62c9e65817e25b077f88222c682efa0188ccb (patch)
tree077abb80fc469c06f08cc4509ff72bcbee8384c7 /Source/cmOrderLinkDirectories.cxx
parent262295615925c082ec3f98c3fc1f6c259d09ee6f (diff)
downloadCMake-22c62c9e65817e25b077f88222c682efa0188ccb.zip
CMake-22c62c9e65817e25b077f88222c682efa0188ccb.tar.gz
CMake-22c62c9e65817e25b077f88222c682efa0188ccb.tar.bz2
BUG: Sweeping changes to cleanup computation of target names. This should
fix many bugs related to target names being computed inconsistently. - Centralized computation of a target's file name to a method in cmTarget. Now that global knowledge is always available the *_CMAKE_PATH cache variables are no longer needed. - Centralized computation of link library command lines and link directory search order. - Moved computation of link directories needed to link CMake targets to be after evaluation of linking dependencies. This also removed alot of duplicate code in which each version had its own bugs. This commit is surrounded by the tags CMake-TargetNameCentralization1-pre and CMake-TargetNameCentralization1-post so make the large set of changes easy to identify.
Diffstat (limited to 'Source/cmOrderLinkDirectories.cxx')
-rw-r--r--Source/cmOrderLinkDirectories.cxx53
1 files changed, 16 insertions, 37 deletions
diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx
index bfcd073..b3362ef 100644
--- a/Source/cmOrderLinkDirectories.cxx
+++ b/Source/cmOrderLinkDirectories.cxx
@@ -221,50 +221,29 @@ void cmOrderLinkDirectories::OrderPaths(std::vector<cmStdString>&
}
//-------------------------------------------------------------------
-void cmOrderLinkDirectories::SetLinkInformation(cmTarget& target,
- cmTarget::LinkLibraryType
- linktype,
- const char* targetLibrary)
+void cmOrderLinkDirectories::SetLinkInformation(
+ const char* targetName,
+ const std::vector<std::string>& linkLibraries,
+ const std::vector<std::string>& linkDirectories
+ )
{
- m_TargetName = target.GetName();
- // collect the search paths from the target into paths set
- const std::vector<std::string>& searchPaths = target.GetLinkDirectories();
+ // Save the target name.
+ m_TargetName = targetName;
+
+ // Merge the link directory search path given into our path set.
std::vector<cmStdString> empty;
- for(std::vector<std::string>::const_iterator p = searchPaths.begin();
- p != searchPaths.end(); ++p)
+ for(std::vector<std::string>::const_iterator p = linkDirectories.begin();
+ p != linkDirectories.end(); ++p)
{
m_DirectoryToAfterList[*p] = empty;
m_LinkPathSet.insert(*p);
}
- // collect the link items from the target and put it into libs
- const cmTarget::LinkLibraries& tlibs = target.GetLinkLibraries();
- std::vector<cmStdString> libs;
- for(cmTarget::LinkLibraries::const_iterator lib = tlibs.begin();
- lib != tlibs.end(); ++lib)
+
+ // Append the link library list into our raw list.
+ for(std::vector<std::string>::const_iterator l = linkLibraries.begin();
+ l != linkLibraries.end(); ++l)
{
- // skip zero size library entries, this may happen
- // if a variable expands to nothing.
- if (lib->first.size() == 0)
- {
- continue;
- }
- // Don't link the library against itself!
- if(targetLibrary && (lib->first == targetLibrary) &&
- target.GetType() != cmTarget::EXECUTABLE)
- {
- continue;
- }
- // use the correct lib for the current configuration
- if (lib->second == cmTarget::DEBUG && linktype != cmTarget::DEBUG)
- {
- continue;
- }
- if (lib->second == cmTarget::OPTIMIZED &&
- (linktype != cmTarget::OPTIMIZED && linktype != cmTarget::GENERAL))
- {
- continue;
- }
- m_RawLinkItems.push_back(lib->first);
+ m_RawLinkItems.push_back(*l);
}
}