summaryrefslogtreecommitdiff
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2004-04-26 11:00:41 -0400
committerBrad King <brad.king@kitware.com>2004-04-26 11:00:41 -0400
commit7c0844d2f4f98d40bc4bb7be89cc75740506db3c (patch)
treedbc501552f9d74a09125245219752403c4893bb2 /Source/cmFindPackageCommand.cxx
parentb6f7e08242fd95fb979ac780c0bb02b5f32374a9 (diff)
downloadcmake-7c0844d2f4f98d40bc4bb7be89cc75740506db3c.tar.gz
BUG#682: Adding environment variable check to FIND_PACKAGE command.
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r--Source/cmFindPackageCommand.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 3b782015a8..7026bc9a69 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -326,6 +326,20 @@ bool cmFindPackageCommand::FindConfig()
//----------------------------------------------------------------------------
std::string cmFindPackageCommand::SearchForConfig() const
{
+ // Check the environment variable.
+ std::string env;
+ if(cmSystemTools::GetEnv(this->Variable.c_str(), env) && env.length() > 0)
+ {
+ cmSystemTools::ConvertToUnixSlashes(env);
+ std::string f = env;
+ f += "/";
+ f += this->Config;
+ if(cmSystemTools::FileExists(f.c_str()))
+ {
+ return env;
+ }
+ }
+
// Search the build directories.
for(std::vector<cmStdString>::const_iterator b = this->Builds.begin();
b != this->Builds.end(); ++b)