diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-02-01 19:42:54 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-02-02 16:09:00 (GMT) |
commit | bd805a51ae4b5be5be6bbadf4afab108fcf4ddb3 (patch) | |
tree | 9f487e27f9af0ef2b9c092919c1165c85bb4bc11 /Source/cmSearchPath.h | |
parent | 92459258108c0036808f29f83a8503fea18ccee9 (diff) | |
download | CMake-bd805a51ae4b5be5be6bbadf4afab108fcf4ddb3.zip CMake-bd805a51ae4b5be5be6bbadf4afab108fcf4ddb3.tar.gz CMake-bd805a51ae4b5be5be6bbadf4afab108fcf4ddb3.tar.bz2 |
Refactor: Keep track of prefixes in cmSearchPath
Diffstat (limited to 'Source/cmSearchPath.h')
-rw-r--r-- | Source/cmSearchPath.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/Source/cmSearchPath.h b/Source/cmSearchPath.h index 09f9722..08f9cfa 100644 --- a/Source/cmSearchPath.h +++ b/Source/cmSearchPath.h @@ -29,7 +29,18 @@ public: cmSearchPath(const cmSearchPath&) = default; cmSearchPath& operator=(const cmSearchPath&) = default; - const std::vector<std::string>& GetPaths() const { return this->Paths; } + struct PathWithPrefix + { + std::string Path; + std::string Prefix; + + bool operator<(const PathWithPrefix& other) const + { + return this->Path < other.Path || + (this->Path == other.Path && this->Prefix < other.Prefix); + } + }; + const std::vector<PathWithPrefix>& GetPaths() const { return this->Paths; } std::size_t size() const { return this->Paths.size(); } void ExtractWithout(const std::set<std::string>& ignore, @@ -47,8 +58,9 @@ public: const char* base = nullptr); protected: - void AddPathInternal(const std::string& path, const char* base = nullptr); + void AddPathInternal(const std::string& path, const std::string& prefix, + const char* base = nullptr); cmFindCommon* FC; - std::vector<std::string> Paths; + std::vector<PathWithPrefix> Paths; }; |