cmFindPackageCommand.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 "cmStandardIncludes.h"
  16. #include "cmCommand.h"
  17. /** \class cmFindPackageCommand
  18. * \brief Load settings from an external project.
  19. *
  20. * cmFindPackageCommand
  21. */
  22. class cmFindPackageCommand : public cmCommand
  23. {
  24. public:
  25. /**
  26. * This is a virtual constructor for the command.
  27. */
  28. virtual cmCommand* Clone()
  29. {
  30. return new cmFindPackageCommand;
  31. }
  32. /**
  33. * This is called when the command is first encountered in
  34. * the CMakeLists.txt file.
  35. */
  36. virtual bool InitialPass(std::vector<std::string> const& args);
  37. /**
  38. * The name of the command as specified in CMakeList.txt.
  39. */
  40. virtual const char* GetName() { return "FIND_PACKAGE";}
  41. /**
  42. * Succinct documentation.
  43. */
  44. virtual const char* GetTerseDocumentation()
  45. {
  46. return "Load settings for an external project.";
  47. }
  48. /**
  49. * More documentation.
  50. */
  51. virtual const char* GetFullDocumentation()
  52. {
  53. return
  54. "FIND_PACKAGE(<name> [major.minor])\n"
  55. "Finds and loads settings from an external project. <name>_FOUND will\n"
  56. "be set to indicate whether the package was found. Settings that\n"
  57. "can be used when <name>_FOUND is true are package-specific.";
  58. }
  59. cmTypeMacro(cmFindPackageCommand, cmCommand);
  60. private:
  61. bool FindModule(bool& found);
  62. bool FindConfig();
  63. std::string SearchForConfig() const;
  64. bool ReadListFile(const char* f);
  65. cmStdString Name;
  66. cmStdString UpperName;
  67. cmStdString Variable;
  68. cmStdString Config;
  69. std::vector<cmStdString> Builds;
  70. std::vector<cmStdString> Prefixes;
  71. std::vector<cmStdString> Relatives;
  72. };
  73. #endif