cmFindBase.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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() const;
  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. bool NamesPerDir;
  45. bool NamesPerDirAllowed;
  46. // CMAKE_*_PATH CMAKE_SYSTEM_*_PATH FRAMEWORK|LIBRARY|INCLUDE|PROGRAM
  47. cmStdString EnvironmentPath; // LIB,INCLUDE
  48. bool AlreadyInCache;
  49. bool AlreadyInCacheWithoutMetaInfo;
  50. private:
  51. // Add pieces of the search.
  52. void AddCMakeEnvironmentPath();
  53. void AddCMakeVariablePath();
  54. void AddSystemEnvironmentPath();
  55. void AddCMakeSystemVariablePath();
  56. void AddUserHintsPath();
  57. void AddUserGuessPath();
  58. // Helpers.
  59. void AddCMakePrefixPath(const char* variable);
  60. void AddEnvPrefixPath(const char* variable);
  61. void AddPrefixPaths(std::vector<std::string> const& in_paths,
  62. PathType pathType);
  63. };
  64. #endif