summaryrefslogtreecommitdiffstats
path: root/Source/cmFindPackageCommand.cxx
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2010-08-12 22:20:47 (GMT)
committerBrad King <brad.king@kitware.com>2010-08-13 15:53:28 (GMT)
commit1221581aa8de2b4bb06e09894940dba6ff90caa1 (patch)
tree0b2559f8f54e203d189056464c48e8d096ab73da /Source/cmFindPackageCommand.cxx
parent7b632e5ac62cb2af74025b71660a1c5822fcfc39 (diff)
downloadCMake-1221581aa8de2b4bb06e09894940dba6ff90caa1.zip
CMake-1221581aa8de2b4bb06e09894940dba6ff90caa1.tar.gz
CMake-1221581aa8de2b4bb06e09894940dba6ff90caa1.tar.bz2
Teach find_* commands to ignore some paths
Add platform configuration variable CMAKE_SYSTEM_IGNORE_PATH and user configuration variable CMAKE_IGNORE_PATH. These specify a set of directories that will be ignored by all the find commands. Update FindPackageTest so that several cases will fail without a functioning CMAKE_IGNORE_PATH.
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 bd58f56..eb86014 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -596,6 +596,15 @@ bool cmFindPackageCommand
}
}
+ // get igonored paths from vars and reroot them.
+ std::vector<std::string> ignored;
+ this->GetIgnoredPaths(ignored);
+ this->RerootPaths(ignored);
+
+ // Construct a set of ignored paths
+ this->IgnoredPaths.clear();
+ this->IgnoredPaths.insert(ignored.begin(), ignored.end());
+
// Find and load the package.
bool result = this->HandlePackageMode();
this->AppendSuccessInformation();
@@ -1431,6 +1440,11 @@ bool cmFindPackageCommand::CheckDirectory(std::string const& dir)
bool cmFindPackageCommand::FindConfigFile(std::string const& dir,
std::string& file)
{
+ if (this->IgnoredPaths.count(dir))
+ {
+ return false;
+ }
+
for(std::vector<std::string>::const_iterator ci = this->Configs.begin();
ci != this->Configs.end(); ++ci)
{