[CMake] CMAKE_LIBRARY_PATH appears not to work properly for finding libtcl
    Bill Hoffman 
    bill.hoffman at kitware.com
       
    Sat May 15 09:43:37 EDT 2010
    
    
  
OK, your right, it does prefer names that show up first in the name list 
even if they are later in the total path.
Here is what the code does:
The ivar this->SearchPaths is the super path in the this function:
std::string cmFindProgramCommand::FindProgram(std::vector<std::string> 
names)
{
   std::string program = "";
   if(this->SearchAppBundleFirst || this->SearchAppBundleOnly)
     {
     program = FindAppBundle(names);
     }
// this is the main search, it passes in a list of names,
// and the super path
   if(program.empty() && !this->SearchAppBundleOnly)
     {
     program = cmSystemTools::FindProgram(names, this->SearchPaths, true);
     }
   if(program.empty() && this->SearchAppBundleLast)
     {
     program = this->FindAppBundle(names);
     }
   return program;
}
// FindProgram loops over the names and trys to each
// name in the total path
//
kwsys_stl::string SystemTools::FindProgram(
   const kwsys_stl::vector<kwsys_stl::string>& names,
   const kwsys_stl::vector<kwsys_stl::string>& path,
   bool noSystemPath)
{
   for(kwsys_stl::vector<kwsys_stl::string>::const_iterator it = 
names.begin();
       it != names.end() ; ++it)
     {
     // Try to find the program.
     kwsys_stl::string result = SystemTools::FindProgram(it->c_str(),
                                                   path,
                                                   noSystemPath);
     if ( !result.empty() )
       {
       return result;
       }
     }
   return "";
Not supper easy to fix...   FindProgram is actually a pretty complicated 
function.  But, if someone wants to test/send a patch... :)
Might break something, but I doubt it.  If you have two copies of 
something on a machine, you are bound to make someone unhappy some of 
the time by picking the wrong one...
-Bill
    
    
More information about the CMake
mailing list