cmSearchPath.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmSearchPath_h
  4. #define cmSearchPath_h
  5. #include <cmConfigure.h>
  6. #include "cmStandardIncludes.h"
  7. class cmFindCommon;
  8. /** \class cmSearchPath
  9. * \brief Container for encapsulating a set of search paths
  10. *
  11. * cmSearchPath is a container that encapsulates search path construction and
  12. * management
  13. */
  14. class cmSearchPath
  15. {
  16. public:
  17. // cmSearchPath must be initialized from a valid pointer. The only reason
  18. // for the default is to allow it to be easily used in stl containers.
  19. // Attempting to initialize with a NULL value will fail an assertion
  20. cmSearchPath(cmFindCommon* findCmd = CM_NULLPTR);
  21. ~cmSearchPath();
  22. const std::vector<std::string>& GetPaths() const { return this->Paths; }
  23. void ExtractWithout(const std::set<std::string>& ignore,
  24. std::vector<std::string>& outPaths,
  25. bool clear = false) const;
  26. void AddPath(const std::string& path);
  27. void AddUserPath(const std::string& path);
  28. void AddCMakePath(const std::string& variable);
  29. void AddEnvPath(const std::string& variable);
  30. void AddCMakePrefixPath(const std::string& variable);
  31. void AddEnvPrefixPath(const std::string& variable, bool stripBin = false);
  32. void AddSuffixes(const std::vector<std::string>& suffixes);
  33. protected:
  34. void AddPrefixPaths(const std::vector<std::string>& paths,
  35. const char* base = CM_NULLPTR);
  36. void AddPathInternal(const std::string& path, const char* base = CM_NULLPTR);
  37. cmFindCommon* FC;
  38. std::vector<std::string> Paths;
  39. };
  40. #endif