diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmFindBase.cxx | 2 | ||||
-rw-r--r-- | Source/cmFindCommon.cxx | 17 | ||||
-rw-r--r-- | Source/cmFindCommon.h | 9 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 11 | ||||
-rw-r--r-- | Source/kwsys/testSystemTools.cxx | 2 |
6 files changed, 30 insertions, 13 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 91333c9..a661c20 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 22) -set(CMake_VERSION_PATCH 20220201) +set(CMake_VERSION_PATCH 20220202) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx index a123e44..efc4e3a 100644 --- a/Source/cmFindBase.cxx +++ b/Source/cmFindBase.cxx @@ -168,7 +168,7 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn) } this->ExpandPaths(); - this->ComputeFinalPaths(); + this->ComputeFinalPaths(IgnorePaths::Yes); return true; } diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx index 7631583..c58db1e 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(); diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h index 1a49aff..49d64e4 100644 --- a/Source/cmFindCommon.h +++ b/Source/cmFindCommon.h @@ -82,12 +82,17 @@ protected: /** Place a set of search paths under the search roots. */ void RerootPaths(std::vector<std::string>& paths); - /** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_path variables. */ + /** Get ignored paths from CMAKE_[SYSTEM_]IGNORE_PATH variables. */ void GetIgnoredPaths(std::vector<std::string>& ignore); void GetIgnoredPaths(std::set<std::string>& ignore); /** Compute final search path list (reroot + trailing slash). */ - void ComputeFinalPaths(); + enum class IgnorePaths + { + No, + Yes, + }; + void ComputeFinalPaths(IgnorePaths ignorePaths); /** Compute the current default root path mode. */ void SelectDefaultRootPathMode(); diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 6d788e4..c468a3c 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -1346,7 +1346,7 @@ void cmFindPackageCommand::ComputePrefixes() } this->FillPrefixesUserGuess(); - this->ComputeFinalPaths(); + this->ComputeFinalPaths(IgnorePaths::No); } void cmFindPackageCommand::FillPrefixesPackageRoot() @@ -2286,6 +2286,15 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in) return false; } + // Skip this if it's in ignored paths. + std::string prefixWithoutSlash = prefix_in; + if (prefixWithoutSlash != "/" && prefixWithoutSlash.back() == '/') { + prefixWithoutSlash.erase(prefixWithoutSlash.length() - 1); + } + if (this->IgnoredPaths.count(prefixWithoutSlash)) { + return false; + } + // PREFIX/ (useful on windows or in build trees) if (this->SearchDirectory(prefix_in)) { return true; diff --git a/Source/kwsys/testSystemTools.cxx b/Source/kwsys/testSystemTools.cxx index 21d6f04..487da8d 100644 --- a/Source/kwsys/testSystemTools.cxx +++ b/Source/kwsys/testSystemTools.cxx @@ -336,7 +336,7 @@ static bool CheckFileOperations() // While we're at it, check proper TestFileAccess functionality. bool do_write_test = true; #if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ - defined(__NetBSD__) || defined(__DragonFly__) + defined(__NetBSD__) || defined(__DragonFly__) || defined(__HOS_AIX__) // If we are running as root on POSIX-ish systems (Linux and the BSDs, // at least), ignore this check, as root can always write to files. do_write_test = (getuid() != 0); |