summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2006-03-30 14:17:02 (GMT)
committerKen Martin <ken.martin@kitware.com>2006-03-30 14:17:02 (GMT)
commit7b3be313ee9997879bc1496bb3801021039d4d5b (patch)
treee6bc6b9811d7f96d40a5803f26531a45bb6d1bbc /Source/cmGlobalGenerator.cxx
parentd92205b26d9f8421006775b1822da4e642dc4f34 (diff)
downloadCMake-7b3be313ee9997879bc1496bb3801021039d4d5b.zip
CMake-7b3be313ee9997879bc1496bb3801021039d4d5b.tar.gz
CMake-7b3be313ee9997879bc1496bb3801021039d4d5b.tar.bz2
ENH: modified the relative path code to not do relative paths between bin and source
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx49
1 files changed, 39 insertions, 10 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 289bf90..55929fe 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1033,20 +1033,49 @@ cmGlobalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
return in_remote;
}
- // Skip conversion if the path is not in the source or binary tree.
std::string original = in_remote;
- if((original.size() < this->RelativePathTopSource.size() ||
- !cmSystemTools::ComparePath(
- original.substr(0, this->RelativePathTopSource.size()).c_str(),
- this->RelativePathTopSource.c_str())) &&
- (original.size() < this->RelativePathTopBinary.size() ||
- !cmSystemTools::ComparePath(
- original.substr(0, this->RelativePathTopBinary.size()).c_str(),
- this->RelativePathTopBinary.c_str())))
+
+ // Skip conversion if the path and local are not both in the source or both
+ // in the binary tree
+ std::string local_path = cmSystemTools::JoinPath(local);
+ bool should_convert = false;
+
+ // is the root in the binary tree?
+ if (local_path.size() >= this->RelativePathTopBinary.size() &&
+ cmSystemTools::ComparePath
+ (local_path.substr(0, this->RelativePathTopBinary.size()).c_str(),
+ this->RelativePathTopBinary.c_str()))
+ {
+ // is the source also in the binary tree?
+ if (original.size() >= this->RelativePathTopBinary.size() &&
+ cmSystemTools::ComparePath
+ (original.substr(0, this->RelativePathTopBinary.size()).c_str(),
+ this->RelativePathTopBinary.c_str()))
+ {
+ should_convert = true;
+ }
+ }
+
+ if (local_path.size() >= this->RelativePathTopSource.size() &&
+ cmSystemTools::ComparePath
+ (local_path.substr(0, this->RelativePathTopSource.size()).c_str(),
+ this->RelativePathTopSource.c_str()))
+ {
+ // is the source also in the binary tree?
+ if (original.size() >= this->RelativePathTopSource.size() &&
+ cmSystemTools::ComparePath
+ (original.substr(0, this->RelativePathTopSource.size()).c_str(),
+ this->RelativePathTopSource.c_str()))
+ {
+ should_convert = true;
+ }
+ }
+
+ if (!should_convert)
{
return in_remote;
}
-
+
// Identify the longest shared path component between the remote
// path and the local path.
std::vector<std::string> remote;