Merge topic 'add_subdirectory-trailing-slashes'
1df4928
add_subdirectory: Compute output dir with consistent slashes (#10072)
This commit is contained in:
commit
0707e0d422
|
@ -78,7 +78,7 @@ bool cmAddSubDirectoryCommand::InitialPass
|
||||||
// No binary directory was specified. If the source directory is
|
// No binary directory was specified. If the source directory is
|
||||||
// not a subdirectory of the current directory then it is an
|
// not a subdirectory of the current directory then it is an
|
||||||
// error.
|
// error.
|
||||||
if(!cmSystemTools::FindLastString(srcPath.c_str(),
|
if(!cmSystemTools::IsSubDirectory(srcPath.c_str(),
|
||||||
this->Makefile->GetCurrentDirectory()))
|
this->Makefile->GetCurrentDirectory()))
|
||||||
{
|
{
|
||||||
cmOStringStream e;
|
cmOStringStream e;
|
||||||
|
@ -93,10 +93,15 @@ bool cmAddSubDirectoryCommand::InitialPass
|
||||||
|
|
||||||
// Remove the CurrentDirectory from the srcPath and replace it
|
// Remove the CurrentDirectory from the srcPath and replace it
|
||||||
// with the CurrentOutputDirectory.
|
// with the CurrentOutputDirectory.
|
||||||
binPath = srcPath;
|
const char* src = this->Makefile->GetCurrentDirectory();
|
||||||
cmSystemTools::ReplaceString(binPath,
|
const char* bin = this->Makefile->GetCurrentOutputDirectory();
|
||||||
this->Makefile->GetCurrentDirectory(),
|
size_t srcLen = strlen(src);
|
||||||
this->Makefile->GetCurrentOutputDirectory());
|
size_t binLen = strlen(bin);
|
||||||
|
if(srcLen > 0 && src[srcLen-1] == '/')
|
||||||
|
{ --srcLen; }
|
||||||
|
if(binLen > 0 && bin[binLen-1] == '/')
|
||||||
|
{ --binLen; }
|
||||||
|
binPath = std::string(bin, binLen) + srcPath.substr(srcLen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue