diff options
| author | Brad King <brad.king@kitware.com> | 2022-02-03 12:35:16 (GMT) |
|---|---|---|
| committer | Kitware Robot <kwrobot@kitware.com> | 2022-02-03 12:35:23 (GMT) |
| commit | 7077916781ea0997d65db949498754debe43a5e6 (patch) | |
| tree | 020a6a5d13e951c31f828ef62f2ff0bd578f7b5f /Source/cmFindPackageCommand.cxx | |
| parent | 0c0d4e1c7a26fccd873a1053772d7989e18a871a (diff) | |
| parent | 201d8c429843e9e57f833fcca8794f532e6d3028 (diff) | |
| download | CMake-7077916781ea0997d65db949498754debe43a5e6.zip CMake-7077916781ea0997d65db949498754debe43a5e6.tar.gz CMake-7077916781ea0997d65db949498754debe43a5e6.tar.bz2 | |
Merge topic 'cmake-ignore-prefix-path'
201d8c4298 find_*(): Add CMAKE_IGNORE_PREFIX_PATH variable
bd805a51ae Refactor: Keep track of prefixes in cmSearchPath
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !6880
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
| -rw-r--r-- | Source/cmFindPackageCommand.cxx | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index c468a3c..fac0e08 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -665,6 +665,16 @@ bool cmFindPackageCommand::FindPackageUsingConfigMode() this->IgnoredPaths.clear(); this->IgnoredPaths.insert(ignored.begin(), ignored.end()); + // get igonored prefix paths from vars and reroot them. + std::vector<std::string> ignoredPrefixes; + this->GetIgnoredPrefixPaths(ignoredPrefixes); + this->RerootPaths(ignoredPrefixes); + + // Construct a set of ignored prefix paths + this->IgnoredPrefixPaths.clear(); + this->IgnoredPrefixPaths.insert(ignoredPrefixes.begin(), + ignoredPrefixes.end()); + // Find and load the package. return this->HandlePackageMode(HandlePackageModeType::Config); } @@ -1309,7 +1319,7 @@ inline std::size_t collectPathsForDebug(std::string& buffer, return 0; } for (std::size_t i = startIndex; i < paths.size(); i++) { - buffer += " " + paths[i] + "\n"; + buffer += " " + paths[i].Path + "\n"; } return paths.size(); } @@ -2291,7 +2301,8 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) if (prefixWithoutSlash != "/" && prefixWithoutSlash.back() == '/') { prefixWithoutSlash.erase(prefixWithoutSlash.length() - 1); } - if (this->IgnoredPaths.count(prefixWithoutSlash)) { + if (this->IgnoredPaths.count(prefixWithoutSlash) || + this->IgnoredPrefixPaths.count(prefixWithoutSlash)) { return false; } |
