ENH: Simplify reverse cmLocalGenerator::Convert
It does not make sense to call the reverse Convert signature (for remote paths corresponding to CMake-managed directories) with NONE or FULL since they have no path. Patch from Modestas Vainius. See issue #7779.
This commit is contained in:
parent
338d37ee5a
commit
3498a8c668
|
@ -2200,25 +2200,15 @@ std::string cmLocalGenerator::Convert(RelativeRoot remote,
|
||||||
bool optional)
|
bool optional)
|
||||||
{
|
{
|
||||||
const char* remotePath = this->GetRelativeRootPath(remote);
|
const char* remotePath = this->GetRelativeRootPath(remote);
|
||||||
|
|
||||||
|
// The relative root must have a path (i.e. not FULL or NONE)
|
||||||
|
assert(remotePath != 0);
|
||||||
|
|
||||||
if(local && (!optional || this->UseRelativePaths))
|
if(local && (!optional || this->UseRelativePaths))
|
||||||
{
|
{
|
||||||
std::vector<std::string> components;
|
std::vector<std::string> components;
|
||||||
std::string result;
|
cmSystemTools::SplitPath(local, components);
|
||||||
switch(remote)
|
std::string result = this->ConvertToRelativePath(components, remotePath);
|
||||||
{
|
|
||||||
case HOME:
|
|
||||||
case HOME_OUTPUT:
|
|
||||||
case START:
|
|
||||||
case START_OUTPUT:
|
|
||||||
cmSystemTools::SplitPath(local, components);
|
|
||||||
result = this->ConvertToRelativePath(components, remotePath);
|
|
||||||
break;
|
|
||||||
case FULL:
|
|
||||||
result = remotePath;
|
|
||||||
break;
|
|
||||||
case NONE:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return this->ConvertToOutputFormat(result.c_str(), output);
|
return this->ConvertToOutputFormat(result.c_str(), output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue