Bill Hoffman wrote:
OK, your right, it does prefer names that show up first in the name list even if they are later in the total path.
I think I have got the same problem (bug) as had FindFreetype always
getting system lib even if I a custom version was present in a folder
lib under a path specified in
CMAKE_PREFIX_PATH as the system lib was called freetype while the custom
one was called freetype238 and the module was (erroneously??) setting

NAMES freetype libfreetype freetype219 freetype238

I solved switching to

NAMES freetype238 freetype219 freetype libfreetype

It would be good to have it fixed....

Thanks


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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake




_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to