summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-09-22 20:16:56 (GMT)
committerBrad King <brad.king@kitware.com>2009-09-22 20:16:56 (GMT)
commit3fe5f8d96054b21736fca56ffdd6c94ccbcd7228 (patch)
tree676131942426f864daaed5f8b3697101752e71af /Source/cmLocalGenerator.cxx
parent25cf2f4352aa70ab7d6f5a66b8ad38b598a61843 (diff)
downloadCMake-3fe5f8d96054b21736fca56ffdd6c94ccbcd7228.zip
CMake-3fe5f8d96054b21736fca56ffdd6c94ccbcd7228.tar.gz
CMake-3fe5f8d96054b21736fca56ffdd6c94ccbcd7228.tar.bz2
Optionally force conversion to relative path
In cmLocalGenerator::ConvertToRelativePath we normally convert to relative path only if the local and remote paths both lie inside the source tree or both lie inside the build tree. This commit adds an optional 'force' argument to allow conversion even when this rule is violated.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx29
1 files changed, 16 insertions, 13 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 0ab4787..7589520 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2303,7 +2303,7 @@ static bool cmLocalGeneratorNotAbove(const char* a, const char* b)
//----------------------------------------------------------------------------
std::string
cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
- const char* in_remote)
+ const char* in_remote, bool force)
{
// The path should never be quoted.
assert(in_remote[0] != '\"');
@@ -2324,19 +2324,22 @@ cmLocalGenerator::ConvertToRelativePath(const std::vector<std::string>& local,
this->RelativePathsConfigured = true;
}
- // 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);
- if(!((cmLocalGeneratorNotAbove(local_path.c_str(),
- this->RelativePathTopBinary.c_str()) &&
- cmLocalGeneratorNotAbove(in_remote,
- this->RelativePathTopBinary.c_str())) ||
- (cmLocalGeneratorNotAbove(local_path.c_str(),
- this->RelativePathTopSource.c_str()) &&
- cmLocalGeneratorNotAbove(in_remote,
- this->RelativePathTopSource.c_str()))))
+ if(!force)
{
- return in_remote;
+ // 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);
+ if(!((cmLocalGeneratorNotAbove(local_path.c_str(),
+ this->RelativePathTopBinary.c_str()) &&
+ cmLocalGeneratorNotAbove(in_remote,
+ this->RelativePathTopBinary.c_str())) ||
+ (cmLocalGeneratorNotAbove(local_path.c_str(),
+ this->RelativePathTopSource.c_str()) &&
+ cmLocalGeneratorNotAbove(in_remote,
+ this->RelativePathTopSource.c_str()))))
+ {
+ return in_remote;
+ }
}
// Identify the longest shared path component between the remote