From 8e39418f6c6f9ed70adcefd3338ec85568cbee9c Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 5 Apr 2006 11:05:06 -0400 Subject: [PATCH] BUG: Fixed cmOrderLinkDirectories to deal with raw link items that do not yet exist and correct drive letter case to avoid duplicate paths on windows. Fixed cmLocalGenerator to pass CMake targets as full paths to cmOrderLinkDirectories to make sure the ordering will pick up the proper target libraries. --- Source/cmLocalGenerator.cxx | 8 +++++++- Source/cmOrderLinkDirectories.cxx | 22 +++++++++++++++++----- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index fb5b020e0..14205b42e 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1392,7 +1392,13 @@ cmLocalGenerator::ComputeLinkInformation(cmTarget& target, if(tgt) { // This is a CMake target. Ask the target for its real name. - linkLibraries.push_back(tgt->GetFullName(config)); + // Pass the full path to the target file but purposely leave + // off the per-configuration subdirectory. The link directory + // ordering knows how to deal with this. + std::string linkItem = tgt->GetDirectory(0); + linkItem += "/"; + linkItem += tgt->GetFullName(config); + linkLibraries.push_back(linkItem); if(fullPathLibs) { fullPathLibs->push_back(tgt->GetFullPath(config)); diff --git a/Source/cmOrderLinkDirectories.cxx b/Source/cmOrderLinkDirectories.cxx index 5a3b4055e..15728275e 100644 --- a/Source/cmOrderLinkDirectories.cxx +++ b/Source/cmOrderLinkDirectories.cxx @@ -258,12 +258,24 @@ void cmOrderLinkDirectories::SetLinkInformation( for(std::vector::const_iterator p = linkDirectories.begin(); p != linkDirectories.end(); ++p) { - if(this->DirectoryToAfterListEmitted.insert(*p).second) +#ifdef _WIN32 + std::string dir = *p; + // Avoid case problems for windows paths. + if(dir.size() > 2 && dir[1] == ':') + { + if(dir[0] >= 'A' && dir[0] <= 'Z') + { + dir[0] += 'a' - 'A'; + } + } + dir = cmSystemTools::GetActualCaseForPath(dir.c_str()); +#endif + if(this->DirectoryToAfterListEmitted.insert(dir).second) { std::pair > dp; - dp.first = *p; + dp.first = dir; this->DirectoryToAfterList.push_back(dp); - this->LinkPathSet.insert(*p); + this->LinkPathSet.insert(dir); } } @@ -336,8 +348,8 @@ bool cmOrderLinkDirectories::DetermineLibraryPathOrder() } if(!framework) { - cmSystemTools::SplitProgramPath(this->RawLinkItems[i].c_str(), - dir, file); + dir = cmSystemTools::GetFilenamePath(this->RawLinkItems[i]); + file = cmSystemTools::GetFilenameName(this->RawLinkItems[i]); #ifdef _WIN32 // Avoid case problems for windows paths. if(dir.size() > 2 && dir[1] == ':')