summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/FindITK.cmake3
-rw-r--r--Modules/FindVTK.cmake3
-rw-r--r--Source/cmFindPackageCommand.cxx14
3 files changed, 20 insertions, 0 deletions
diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake
index 12d27c6..40c321b 100644
--- a/Modules/FindITK.cmake
+++ b/Modules/FindITK.cmake
@@ -45,6 +45,9 @@ IF(NOT ITK_DIR)
# Look for an installation or build tree.
#
FIND_PATH(ITK_DIR ITKConfig.cmake
+ # Look for an environment variable ITK_DIR.
+ $ENV{ITK_DIR}
+
# Look in places relative to the system executable search path.
${ITK_DIR_SEARCH}
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake
index d2acc9a..519815f 100644
--- a/Modules/FindVTK.cmake
+++ b/Modules/FindVTK.cmake
@@ -65,6 +65,9 @@ IF(NOT VTK_DIR)
# Support legacy cache files.
${VTK_DIR_SEARCH_LEGACY}
+ # Look for an environment variable VTK_DIR.
+ $ENV{VTK_DIR}
+
# Look in places relative to the system executable search path.
${VTK_DIR_SEARCH}
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 3b78201..7026bc9 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)