ENH: add CMAKE_FILE_PATH, CMAKE_PROGRAM_PATH, CMAKE_LIBRARY_PATH, and search them first, PATH second, and last the paths listed in the FIND call

This commit is contained in:
Bill Hoffman 2004-06-30 11:31:41 -04:00
parent 35033f248d
commit 40fbba22a4
2 changed files with 8 additions and 6 deletions

View File

@ -2149,12 +2149,12 @@ std::string cmMakefile::FindLibrary(const char* name,
{ {
return cmSystemTools::CollapseFullPath(name); return cmSystemTools::CollapseFullPath(name);
} }
// Add the system search path to our path. // Add the system search path to our path.
std::vector<std::string> path = userPaths; std::vector<std::string> path;
cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH"); cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH");
cmSystemTools::GetPath(path); cmSystemTools::GetPath(path);
// now add the path
path.insert(path.end(), userPaths.begin(), userPaths.end());
// Add some lib directories specific to compilers, depending on the // Add some lib directories specific to compilers, depending on the
// current generator, so that library that might have been stored here // current generator, so that library that might have been stored here
// can be found too. // can be found too.

View File

@ -1096,7 +1096,8 @@ kwsys_stl::string SystemTools::FindFile(const char* name,
const kwsys_stl::vector<kwsys_stl::string>& userPaths) const kwsys_stl::vector<kwsys_stl::string>& userPaths)
{ {
// Add the system search path to our path first // Add the system search path to our path first
kwsys_stl::vector<kwsys_stl::string> path; kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
SystemTools::GetPath(path); SystemTools::GetPath(path);
// now add the additional paths // now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end()); path.insert(path.end(), userPaths.begin(), userPaths.end());
@ -1145,13 +1146,14 @@ kwsys_stl::string SystemTools::FindProgram(
{ {
return SystemTools::CollapseFullPath(tryPath.c_str()); return SystemTools::CollapseFullPath(tryPath.c_str());
} }
// Add the system search path to our path.
kwsys_stl::vector<kwsys_stl::string> path; kwsys_stl::vector<kwsys_stl::string> path;
SystemTools::GetPath(path, "CMAKE_PROGRAM_PATH");
// Add the system search path to our path.
if (!no_system_path) if (!no_system_path)
{ {
SystemTools::GetPath(path); SystemTools::GetPath(path);
} }
// now add the additional paths // now add the additional paths
path.insert(path.end(), userPaths.begin(), userPaths.end()); path.insert(path.end(), userPaths.begin(), userPaths.end());