summaryrefslogtreecommitdiff
path: root/Source/cmFindCommon.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2022-01-28 16:15:17 -0500
committerKyle Edwards <kyle.edwards@kitware.com>2022-01-31 10:41:04 -0500
commit11f97d196880e78717211ab68138e9ff922ec826 (patch)
tree400e8f63b976ecc00afd03b4ce66ca44c27040c7 /Source/cmFindCommon.cxx
parent30e5c1d92baf6e5ac0daed4e4debcdf208968a65 (diff)
downloadcmake-11f97d196880e78717211ab68138e9ff922ec826.tar.gz
find_package(): Refactor CMAKE_[SYSTEM_]IGNORE_PATH
In the old implementation, CMAKE_[SYSTEM_]IGNORE_PATH was handled in cmFindCommon. Move it into cmFindPackageCommand.
Diffstat (limited to 'Source/cmFindCommon.cxx')
-rw-r--r--Source/cmFindCommon.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 7631583d4f..c58db1e67e 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -283,14 +283,15 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
{
- // null-terminated list of paths.
- static const char* paths[] = { "CMAKE_SYSTEM_IGNORE_PATH",
- "CMAKE_IGNORE_PATH", nullptr };
+ static constexpr const char* paths[] = {
+ "CMAKE_SYSTEM_IGNORE_PATH",
+ "CMAKE_IGNORE_PATH",
+ };
// Construct the list of path roots with no trailing slashes.
- for (const char** pathName = paths; *pathName; ++pathName) {
+ for (const char* pathName : paths) {
// Get the list of paths to ignore from the variable.
- this->Makefile->GetDefExpandList(*pathName, ignore);
+ this->Makefile->GetDefExpandList(pathName, ignore);
}
for (std::string& i : ignore) {
@@ -365,11 +366,13 @@ static void AddTrailingSlash(std::string& s)
s += '/';
}
}
-void cmFindCommon::ComputeFinalPaths()
+void cmFindCommon::ComputeFinalPaths(IgnorePaths ignorePaths)
{
// Filter out ignored paths from the prefix list
std::set<std::string> ignored;
- this->GetIgnoredPaths(ignored);
+ if (ignorePaths == IgnorePaths::Yes) {
+ this->GetIgnoredPaths(ignored);
+ }
// Combine the separate path types, filtering out ignores
this->SearchPaths.clear();