cmFindBase.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 cmFindBase_h
  4. #define cmFindBase_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cmFindCommon.h"
  9. class cmExecutionStatus;
  10. /** \class cmFindBase
  11. * \brief Base class for most FIND_XXX commands.
  12. *
  13. * cmFindBase is a parent class for cmFindProgramCommand, cmFindPathCommand,
  14. * and cmFindLibraryCommand, cmFindFileCommand
  15. */
  16. class cmFindBase : public cmFindCommon
  17. {
  18. public:
  19. cmFindBase(cmExecutionStatus& status);
  20. virtual ~cmFindBase() = default;
  21. /**
  22. * This is called when the command is first encountered in
  23. * the CMakeLists.txt file.
  24. */
  25. virtual bool ParseArguments(std::vector<std::string> const& args);
  26. protected:
  27. void PrintFindStuff();
  28. void ExpandPaths();
  29. // see if the VariableName is already set in the cache,
  30. // also copy the documentation from the cache to VariableDocumentation
  31. // if it has documentation in the cache
  32. bool CheckForVariableInCache();
  33. // use by command during find
  34. std::string VariableDocumentation;
  35. std::string VariableName;
  36. std::vector<std::string> Names;
  37. bool NamesPerDir;
  38. bool NamesPerDirAllowed;
  39. // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
  40. std::string EnvironmentPath; // LIB,INCLUDE
  41. bool AlreadyInCache;
  42. bool AlreadyInCacheWithoutMetaInfo;
  43. private:
  44. // Add pieces of the search.
  45. void FillPackageRootPath();
  46. void FillCMakeVariablePath();
  47. void FillCMakeEnvironmentPath();
  48. void FillUserHintsPath();
  49. void FillSystemEnvironmentPath();
  50. void FillCMakeSystemVariablePath();
  51. void FillUserGuessPath();
  52. };
  53. #endif