diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index dc1d219d9..42fc3bdd0 100644 --- a/Source/cmFindLibraryCommand.h +++ b/Source/cmFindLibraryCommand.h @@ -87,7 +87,8 @@ public: " FIND_LIBRARY(VAR libraryName [path1 path2 ...])\n" "Find a library with the given name by searching in the specified " "paths. This is a short-hand signature for the command that is " - "sufficient in many cases."; + "sufficient in many cases. The environment variable CMAKE_LIBRARY_PATH " + "is searched as well as the PATH variable.\n"; } cmTypeMacro(cmFindLibraryCommand, cmCommand); diff --git a/Source/cmFindPathCommand.cxx b/Source/cmFindPathCommand.cxx index 3385582b8..d454715e1 100644 --- a/Source/cmFindPathCommand.cxx +++ b/Source/cmFindPathCommand.cxx @@ -75,7 +75,7 @@ bool cmFindPathCommand::InitialPass(std::vector const& argsIn) // Glob the entry in case of wildcards. cmSystemTools::GlobDirs(exp.c_str(), path); } - + cmSystemTools::GetPath(path, "CMAKE_INCLUDE_PATH"); // add the standard path cmSystemTools::GetPath(path); unsigned int k; diff --git a/Source/cmFindPathCommand.h b/Source/cmFindPathCommand.h index 4fa4c75b8..bafc45069 100644 --- a/Source/cmFindPathCommand.h +++ b/Source/cmFindPathCommand.h @@ -81,7 +81,8 @@ public: " is created to store the result. If the file is not " "found, the result will be -NOTFOUND. If DOC is specified " "then the next argument is treated as a documentation string for " - "the cache entry .\n"; + "the cache entry . The environment variable CMAKE_INCLUDE_PATH " + "is searched as well as the PATH variable.\n"; } cmTypeMacro(cmFindPathCommand, cmCommand); diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 59b270adb..aa8b1afe2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -2133,6 +2133,7 @@ std::string cmMakefile::FindLibrary(const char* name, // Add the system search path to our path. std::vector path = userPaths; + cmSystemTools::GetPath(path, "CMAKE_LIBRARY_PATH"); cmSystemTools::GetPath(path); // Add some lib directories specific to compilers, depending on the diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index 8b26cb37b..b7ad66b26 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -158,14 +158,18 @@ SystemTools::GetTime(void) } // adds the elements of the env variable path to the arg passed in -void SystemTools::GetPath(kwsys_stl::vector& path) +void SystemTools::GetPath(kwsys_stl::vector& path, const char* env) { #if defined(_WIN32) && !defined(__CYGWIN__) const char* pathSep = ";"; #else const char* pathSep = ":"; #endif - kwsys_stl::string pathEnv = getenv("PATH"); + if(!env) + { + env = "PATH"; + } + kwsys_stl::string pathEnv = getenv(env); // A hack to make the below algorithm work. if(pathEnv[pathEnv.length()-1] != ':') { diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index fc6acf09d..1676ff27d 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -121,9 +121,10 @@ public: static unsigned long FileLength(const char *filename); /** * Add the paths from the environment variable PATH to the - * string vector passed in. + * string vector passed in. If env is set then the value + * of env will be used instead of PATH. */ - static void GetPath(kwsys_stl::vector& path); + static void GetPath(kwsys_stl::vector& path, const char* env=0); /** Read an environment variable. */ static const char* GetEnv(const char* key);