diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx index a9939dd71..d0f75197d 100644 --- a/Source/cmFindLibraryCommand.cxx +++ b/Source/cmFindLibraryCommand.cxx @@ -492,19 +492,22 @@ std::string cmFindLibraryCommand::FindNormalLibrary() //---------------------------------------------------------------------------- std::string cmFindLibraryCommand::FindFrameworkLibrary() { - // Search for a framework of each name in the entire search path. + std::string fwPath; + // Search for each name in all search paths. for(std::vector::const_iterator ni = this->Names.begin(); ni != this->Names.end() ; ++ni) { - // Search the paths for a framework with this name. - std::string fwName = *ni; - fwName += ".framework"; - std::string fwPath = cmSystemTools::FindDirectory(fwName.c_str(), - this->SearchPaths, - true); - if(!fwPath.empty()) + for(std::vector::const_iterator + di = this->SearchPaths.begin(); + di != this->SearchPaths.end(); ++di) { - return fwPath; + fwPath = *di; + fwPath += *ni; + fwPath += ".framework"; + if(cmSystemTools::FileIsDirectory(fwPath.c_str())) + { + return cmSystemTools::CollapseFullPath(fwPath.c_str()); + } } }