summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-12-01 15:44:48 (GMT)
committerBrad King <brad.king@kitware.com>2015-12-01 16:00:32 (GMT)
commit6b1852874325520a418eb05ec3c2149c2eb194a2 (patch)
treeaed0038062bde360f5afe24021afeda3ae5cd465 /Source
parentb4a2ada297214119647b26df8abe394cd73ca53a (diff)
downloadCMake-6b1852874325520a418eb05ec3c2149c2eb194a2.zip
CMake-6b1852874325520a418eb05ec3c2149c2eb194a2.tar.gz
CMake-6b1852874325520a418eb05ec3c2149c2eb194a2.tar.bz2
cmOrderDirectories: Factor out directory comparison
Create an `IsSameDirectory` helper method.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmOrderDirectories.cxx13
-rw-r--r--Source/cmOrderDirectories.h3
2 files changed, 12 insertions, 4 deletions
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 35ee127..9491204 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -73,10 +73,8 @@ public:
{
// Check if this directory conflicts with the entry.
std::string const& dir = this->OD->OriginalDirectories[i];
- if(dir != this->Directory &&
- cmSystemTools::GetRealPath(dir) !=
- cmSystemTools::GetRealPath(this->Directory) &&
- this->FindConflict(dir))
+ if (!this->OD->IsSameDirectory(dir, this->Directory) &&
+ this->FindConflict(dir))
{
// The library will be found in this directory but this is not
// the directory named for it. Add an entry to make sure the
@@ -639,3 +637,10 @@ void cmOrderDirectories::DiagnoseCycle()
->IssueMessage(cmake::WARNING, e.str(),
this->Target->Target->GetBacktrace());
}
+
+bool cmOrderDirectories::IsSameDirectory(std::string const& l,
+ std::string const& r)
+{
+ return (l == r ||
+ cmSystemTools::GetRealPath(l) == cmSystemTools::GetRealPath(r));
+}
diff --git a/Source/cmOrderDirectories.h b/Source/cmOrderDirectories.h
index 211c786..0657e92 100644
--- a/Source/cmOrderDirectories.h
+++ b/Source/cmOrderDirectories.h
@@ -80,6 +80,9 @@ private:
struct ConflictList: public std::vector<ConflictPair> {};
std::vector<ConflictList> ConflictGraph;
+ // Compare directories after resolving symlinks.
+ bool IsSameDirectory(std::string const& l, std::string const& r);
+
friend class cmOrderDirectoriesConstraint;
friend class cmOrderDirectoriesConstraintLibrary;
};