summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-04-22 13:24:20 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2004-04-22 13:24:20 -0400
commitd59e06595c986b53cbb7d537e951ea8af07fe11a (patch)
tree91d4874deab87fac9dcd76f8627c9c5531611427
parent5ff05c35d1099780fa60849e26c95c25499b9722 (diff)
downloadcmake-d59e06595c986b53cbb7d537e951ea8af07fe11a.tar.gz
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
-rw-r--r--Source/cmFindLibraryCommand.h3
-rw-r--r--Source/cmFindPathCommand.cxx2
-rw-r--r--Source/cmFindPathCommand.h3
-rw-r--r--Source/cmMakefile.cxx1
-rw-r--r--Source/kwsys/SystemTools.cxx8
-rw-r--r--Source/kwsys/SystemTools.hxx.in5
6 files changed, 15 insertions, 7 deletions
diff --git a/Source/cmFindLibraryCommand.h b/Source/cmFindLibraryCommand.h
index dc1d219d91..42fc3bdd03 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 3385582b8b..d454715e16 100644
--- a/Source/cmFindPathCommand.cxx
+++ b/Source/cmFindPathCommand.cxx
@@ -75,7 +75,7 @@ bool cmFindPathCommand::InitialPass(std::vector<std::string> 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 4fa4c75b8e..bafc450699 100644
--- a/Source/cmFindPathCommand.h
+++ b/Source/cmFindPathCommand.h
@@ -81,7 +81,8 @@ public:
"<VAR> is created to store the result. If the file is not "
"found, the result will be <VAR>-NOTFOUND. If DOC is specified "
"then the next argument is treated as a documentation string for "
- "the cache entry <VAR>.\n";
+ "the cache entry <VAR>. 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 59b270adb0..aa8b1afe2c 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<std::string> 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 8b26cb37bf..b7ad66b269 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<kwsys_stl::string>& path)
+void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& 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 fc6acf09d6..1676ff27de 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<kwsys_stl::string>& path);
+ static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env=0);
/** Read an environment variable. */
static const char* GetEnv(const char* key);