summaryrefslogtreecommitdiffstats
path: root/Source/cmOrderDirectories.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-12-26 18:28:20 (GMT)
committerBrad King <brad.king@kitware.com>2008-12-26 18:28:20 (GMT)
commit85a46e9e51029499e30f68afdec6b55a31ae54c3 (patch)
treef9cc830b7b9170174bbb986145a7244590979b2f /Source/cmOrderDirectories.cxx
parentb77d00b7f60105204ee20fc92f1ed1fbc2de6b7c (diff)
downloadCMake-85a46e9e51029499e30f68afdec6b55a31ae54c3.zip
CMake-85a46e9e51029499e30f68afdec6b55a31ae54c3.tar.gz
CMake-85a46e9e51029499e30f68afdec6b55a31ae54c3.tar.bz2
BUG: Fix same-file check for directory ordering
When computing runtime search path ordering a constraint exists when a file that may be found by the runtime search exists in a directory other than that containing the desired file. We test whether a potential conflict is really the same due to a symlink. Recently the change to cmFindLibraryCommand to load directory content created a case in which the same-file check would be incorrectly skipped. This avoids skipping the check.
Diffstat (limited to 'Source/cmOrderDirectories.cxx')
-rw-r--r--Source/cmOrderDirectories.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 54f23f7..24b7138 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -113,25 +113,22 @@ protected:
bool cmOrderDirectoriesConstraint::FileMayConflict(std::string const& dir,
std::string const& name)
{
- // Check if the file will be built by cmake.
- std::set<cmStdString> const& files =
- (this->GlobalGenerator->GetDirectoryContent(dir, false));
- if(std::set<cmStdString>::const_iterator(files.find(name)) != files.end())
- {
- return true;
- }
-
- // Check if the file exists on disk and is not a symlink back to the
- // original file.
+ // Check if the file exists on disk.
std::string file = dir;
file += "/";
file += name;
- if(cmSystemTools::FileExists(file.c_str(), true) &&
- !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str()))
+ if(cmSystemTools::FileExists(file.c_str(), true))
{
- return true;
+ // The file conflicts only if it is not the same as the original
+ // file due to a symlink or hardlink.
+ return !cmSystemTools::SameFile(this->FullPath.c_str(), file.c_str());
}
- return false;
+
+ // Check if the file will be built by cmake.
+ std::set<cmStdString> const& files =
+ (this->GlobalGenerator->GetDirectoryContent(dir, false));
+ std::set<cmStdString>::const_iterator fi = files.find(name);
+ return fi != files.end();
}
//----------------------------------------------------------------------------