From d59e06595c986b53cbb7d537e951ea8af07fe11a Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 22 Apr 2004 13:24:20 -0400 Subject: BUG: fix for 301 CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH env vars now used in FIND_LIBRARY and FIND_PATH in addtion to and before PATH --- Source/cmFindLibraryCommand.h | 3 ++- Source/cmFindPathCommand.cxx | 2 +- Source/cmFindPathCommand.h | 3 ++- Source/cmMakefile.cxx | 1 + Source/kwsys/SystemTools.cxx | 8 ++++++-- Source/kwsys/SystemTools.hxx.in | 5 +++-- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h index dc1d219..42fc3bd 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 3385582..d454715 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 4fa4c75..bafc450 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 59b270a..aa8b1af 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 8b26cb3..b7ad66b 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 fc6acf0..1676ff2 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); -- cgit v0.12