diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-01-26 21:35:54 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-02-02 16:09:00 (GMT) |
commit | 201d8c429843e9e57f833fcca8794f532e6d3028 (patch) | |
tree | a66090c1d5445466e189f149a11c1b1bfde84667 /Source/cmFindPackageCommand.cxx | |
parent | bd805a51ae4b5be5be6bbadf4afab108fcf4ddb3 (diff) | |
download | CMake-201d8c429843e9e57f833fcca8794f532e6d3028.zip CMake-201d8c429843e9e57f833fcca8794f532e6d3028.tar.gz CMake-201d8c429843e9e57f833fcca8794f532e6d3028.tar.bz2 |
find_*(): Add CMAKE_IGNORE_PREFIX_PATH variable
Fixes: #20878
Diffstat (limited to 'Source/cmFindPackageCommand.cxx')
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 85badf6..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); } @@ -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; } |