cmFindPackageCommand.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmFindPackageCommand_h
  14. #define cmFindPackageCommand_h
  15. #include "cmFindCommon.h"
  16. class cmFindPackageFileList;
  17. /** \class cmFindPackageCommand
  18. * \brief Load settings from an external project.
  19. *
  20. * cmFindPackageCommand
  21. */
  22. class cmFindPackageCommand : public cmFindCommon
  23. {
  24. public:
  25. cmFindPackageCommand();
  26. /**
  27. * This is a virtual constructor for the command.
  28. */
  29. virtual cmCommand* Clone()
  30. {
  31. return new cmFindPackageCommand;
  32. }
  33. /**
  34. * This is called when the command is first encountered in
  35. * the CMakeLists.txt file.
  36. */
  37. virtual bool InitialPass(std::vector<std::string> const& args,
  38. cmExecutionStatus &status);
  39. /**
  40. * This determines if the command is invoked when in script mode.
  41. */
  42. virtual bool IsScriptable() { return true; }
  43. /**
  44. * The name of the command as specified in CMakeList.txt.
  45. */
  46. virtual const char* GetName() { return "find_package";}
  47. /**
  48. * Succinct documentation.
  49. */
  50. virtual const char* GetTerseDocumentation()
  51. {
  52. return "Load settings for an external project.";
  53. }
  54. /**
  55. * More documentation.
  56. */
  57. virtual const char* GetFullDocumentation();
  58. cmTypeMacro(cmFindPackageCommand, cmFindCommon);
  59. private:
  60. void AppendSuccessInformation();
  61. void AppendToProperty(const char* propertyName);
  62. bool FindModule(bool& found);
  63. bool HandlePackageMode();
  64. void FindConfig();
  65. bool FindPrefixedConfig();
  66. bool FindFrameworkConfig();
  67. bool FindAppBundleConfig();
  68. bool ReadListFile(const char* f);
  69. void AddUserPath(std::string const& p);
  70. void ComputePrefixes();
  71. bool SearchDirectory(std::string const& dir);
  72. bool CheckDirectory(std::string const& dir);
  73. bool FindConfigFile(std::string const& dir, std::string& file);
  74. bool SearchPrefix(std::string const& prefix);
  75. bool SearchFrameworkPrefix(std::string const& prefix_in);
  76. bool SearchAppBundlePrefix(std::string const& prefix_in);
  77. friend class cmFindPackageFileList;
  78. std::string CommandDocumentation;
  79. cmStdString Name;
  80. cmStdString Variable;
  81. cmStdString Version;
  82. unsigned int VersionMajor;
  83. unsigned int VersionMinor;
  84. unsigned int VersionPatch;
  85. unsigned int VersionCount;
  86. cmStdString FileFound;
  87. bool Quiet;
  88. bool Required;
  89. bool Compatibility_1_6;
  90. bool NoModule;
  91. bool NoBuilds;
  92. bool DebugMode;
  93. std::vector<std::string> Names;
  94. std::vector<std::string> Configs;
  95. std::vector<std::string> Prefixes;
  96. std::vector<std::string> UserPaths;
  97. };
  98. #endif