cmSearchPath.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmSearchPath_h
  11. #define cmSearchPath_h
  12. #include "cmStandardIncludes.h"
  13. class cmFindCommon;
  14. /** \class cmSearchPath
  15. * \brief Container for encapsulating a set of search paths
  16. *
  17. * cmSearchPath is a container that encapsulates search path construction and
  18. * management
  19. */
  20. class cmSearchPath
  21. {
  22. public:
  23. // cmSearchPath must be initialized from a valid pointer. The only reason
  24. // for teh 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 = 0);
  27. ~cmSearchPath();
  28. const std::vector<std::string>& GetPaths() const { return this->Paths; }
  29. void ExtractWithout(const std::set<std::string>& ignore,
  30. std::vector<std::string>& outPaths,
  31. bool clear = false) const;
  32. void AddPath(const std::string& path);
  33. void AddUserPath(const std::string& path);
  34. void AddCMakePath(const std::string& variable);
  35. void AddEnvPath(const std::string& variable);
  36. void AddCMakePrefixPath(const std::string& variable);
  37. void AddEnvPrefixPath(const std::string& variable);
  38. void AddSuffixes(const std::vector<std::string>& suffixes);
  39. protected:
  40. void AddPrefixPaths(const std::vector<std::string>& paths,
  41. const char *base = 0);
  42. void AddPathInternal(const std::string& path, const char *base = 0);
  43. cmFindCommon *FC;
  44. std::vector<std::string> Paths;
  45. };
  46. #endif