summaryrefslogtreecommitdiffstats
path: root/Source/cmStateDirectory.cxx
diff options
context:
space:
mode:
authorBruno Manganelli <bruno.manga95@gmail.com>2018-11-23 02:16:51 (GMT)
committerBruno Manganelli <bruno.manga95@gmail.com>2018-12-08 11:24:06 (GMT)
commit33f08eec18b440eac1f24f6f18b971c6203307bd (patch)
treeefb4e1304611ce92cd8b6312f4dffa1cad6d2045 /Source/cmStateDirectory.cxx
parent87e810f223bad6fb889e7ae4ad08be98461bf6e2 (diff)
downloadCMake-33f08eec18b440eac1f24f6f18b971c6203307bd.zip
CMake-33f08eec18b440eac1f24f6f18b971c6203307bd.tar.gz
CMake-33f08eec18b440eac1f24f6f18b971c6203307bd.tar.bz2
cmOutputConverter: Moved ContainedInDirectory to cmStateDirectory
Diffstat (limited to 'Source/cmStateDirectory.cxx')
-rw-r--r--Source/cmStateDirectory.cxx17
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmStateDirectory.cxx b/Source/cmStateDirectory.cxx
index f94e714..40f694c 100644
--- a/Source/cmStateDirectory.cxx
+++ b/Source/cmStateDirectory.cxx
@@ -138,6 +138,23 @@ void cmStateDirectory::SetRelativePathTopBinary(const char* dir)
this->DirectoryState->RelativePathTopBinary = dir;
}
+bool cmStateDirectory::ContainsBoth(std::string const& local_path,
+ std::string const& remote_path) const
+{
+ auto PathEqOrSubDir = [](std::string const& a, std::string const& b) {
+ return (cmSystemTools::ComparePath(a, b) ||
+ cmSystemTools::IsSubDirectory(a, b));
+ };
+
+ bool bothInBinary = PathEqOrSubDir(local_path, GetRelativePathTopBinary()) &&
+ PathEqOrSubDir(remote_path, GetRelativePathTopBinary());
+
+ bool bothInSource = PathEqOrSubDir(local_path, GetRelativePathTopSource()) &&
+ PathEqOrSubDir(remote_path, GetRelativePathTopSource());
+
+ return bothInBinary || bothInSource;
+}
+
cmStateDirectory::cmStateDirectory(
cmLinkedTree<cmStateDetail::BuildsystemDirectoryStateType>::iterator iter,
const cmStateSnapshot& snapshot)