From c46490dad525e5f5e10eba12808718340ad40ace Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 27 Apr 2015 11:45:49 -0400 Subject: 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. --- Source/cmSystemTools.cxx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0e0532d..e2adabe 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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, -- cgit v0.12