cmFindBase.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 cmFindBase_h
  11. #define cmFindBase_h
  12. #include "cmFindCommon.h"
  13. /** \class cmFindBase
  14. * \brief Base class for most FIND_XXX commands.
  15. *
  16. * cmFindBase is a parent class for cmFindProgramCommand, cmFindPathCommand,
  17. * and cmFindLibraryCommand, cmFindFileCommand
  18. */
  19. class cmFindBase : public cmFindCommon
  20. {
  21. public:
  22. cmFindBase();
  23. /**
  24. * This is called when the command is first encountered in
  25. * the CMakeLists.txt file.
  26. */
  27. virtual bool ParseArguments(std::vector<std::string> const& args);
  28. cmTypeMacro(cmFindBase, cmFindCommon);
  29. virtual const char* GetFullDocumentation();
  30. protected:
  31. virtual void GenerateDocumentation();
  32. void PrintFindStuff();
  33. void ExpandPaths();
  34. void AddPathSuffixes();
  35. // see if the VariableName is already set in the cache,
  36. // also copy the documentation from the cache to VariableDocumentation
  37. // if it has documentation in the cache
  38. bool CheckForVariableInCache();
  39. cmStdString GenericDocumentation;
  40. // use by command during find
  41. cmStdString VariableDocumentation;
  42. cmStdString VariableName;
  43. std::vector<std::string> Names;
  44. // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
  45. cmStdString EnvironmentPath; // LIB,INCLUDE
  46. bool AlreadyInCache;
  47. bool AlreadyInCacheWithoutMetaInfo;
  48. private:
  49. // Add pieces of the search.
  50. void AddCMakeEnvironmentPath();
  51. void AddCMakeVariablePath();
  52. void AddSystemEnvironmentPath();
  53. void AddCMakeSystemVariablePath();
  54. void AddUserHintsPath();
  55. void AddUserGuessPath();
  56. // Helpers.
  57. void AddCMakePrefixPath(const char* variable);
  58. void AddEnvPrefixPath(const char* variable);
  59. void AddPrefixPaths(std::vector<std::string> const& in_paths,
  60. PathType pathType);
  61. };
  62. #endif