diff options
author | Brad King <brad.king@kitware.com> | 2015-04-27 11:45:49 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-27 11:49:29 -0400 |
commit | c46490dad525e5f5e10eba12808718340ad40ace (patch) | |
tree | 767fb017f4d1d22af31994f0eef4eb57a6229d71 /Source/cmSystemTools.cxx | |
parent | ebb54e02c4bfd9ef8ffb92a49afb873a0af58f2a (diff) | |
download | cmake-c46490dad525e5f5e10eba12808718340ad40ace.tar.gz |
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.
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0e0532d33c..e2adabe5f0 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, |