1 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 file Copyright.txt or https://cmake.org/licensing for details. */
5 #include "cmConfigure.h" // IWYU pragma: keep
14 /** \class cmSearchPath
15 * \brief Container for encapsulating a set of search paths
17 * cmSearchPath is a container that encapsulates search path construction and
23 // cmSearchPath must be initialized from a valid pointer. The only reason
24 // for the default is to allow it to be easily used in stl containers.
25 // Attempting to initialize with a NULL value will fail an assertion
26 cmSearchPath(cmFindCommon
* findCmd
= nullptr);
29 cmSearchPath(const cmSearchPath
&) = default;
30 cmSearchPath
& operator=(const cmSearchPath
&) = default;
37 bool operator<(const PathWithPrefix
& other
) const
39 return this->Path
< other
.Path
||
40 (this->Path
== other
.Path
&& this->Prefix
< other
.Prefix
);
43 const std::vector
<PathWithPrefix
>& GetPaths() const { return this->Paths
; }
44 std::size_t size() const { return this->Paths
.size(); }
46 void ExtractWithout(const std::set
<std::string
>& ignorePaths
,
47 const std::set
<std::string
>& ignorePrefixes
,
48 std::vector
<std::string
>& outPaths
,
49 bool clear
= false) const;
51 void AddPath(const std::string
& path
);
52 void AddUserPath(const std::string
& path
);
53 void AddCMakePath(const std::string
& variable
);
54 void AddEnvPath(const std::string
& variable
);
55 void AddCMakePrefixPath(const std::string
& variable
);
56 void AddEnvPrefixPath(const std::string
& variable
, bool stripBin
= false);
57 void AddSuffixes(const std::vector
<std::string
>& suffixes
);
58 void AddPrefixPaths(const std::vector
<std::string
>& paths
,
59 const char* base
= nullptr);
62 void AddPathInternal(const std::string
& path
, const std::string
& prefix
,
63 const char* base
= nullptr);
66 std::vector
<PathWithPrefix
> Paths
;