cmSystemTools: Fix IsPathToFramework implementation (#15535)

Use more reliable logic to detect if a path ends in ".framework".  The
old logic added by commit v2.4.0~791 (add better support for framework
linking, 2005-12-26) did not account for paths not ending in it at all.
With a 9-character path the logic and "npos == -1" happens to make the
old check pass.
This commit is contained in:
Brad King 2015-04-27 11:45:49 -04:00
parent ebb54e02c4
commit c46490dad5
1 changed files with 2 additions and 9 deletions

View File

@ -1486,15 +1486,8 @@ void cmSystemTools::EnableVSConsoleOutput()
bool cmSystemTools::IsPathToFramework(const char* path)
{
if(cmSystemTools::FileIsFullPath(path))
{
std::string libname = path;
if(libname.find(".framework") == libname.size()+1-sizeof(".framework"))
{
return true;
}
}
return false;
return (cmSystemTools::FileIsFullPath(path) &&
cmHasLiteralSuffix(path, ".framework"));
}
bool cmSystemTools::CreateTar(const char* outFileName,