cmDefinePropertyCommand.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 cmDefinesPropertyCommand_h
  11. #define cmDefinesPropertyCommand_h
  12. #include "cmCommand.h"
  13. class cmDefinePropertyCommand : public cmCommand
  14. {
  15. public:
  16. virtual cmCommand* Clone()
  17. {
  18. return new cmDefinePropertyCommand;
  19. }
  20. /**
  21. * This is called when the command is first encountered in
  22. * the input file.
  23. */
  24. virtual bool InitialPass(std::vector<std::string> const& args,
  25. cmExecutionStatus &status);
  26. /**
  27. * The name of the command as specified in CMakeList.txt.
  28. */
  29. virtual const char* GetName() { return "define_property";}
  30. /**
  31. * Succinct documentation.
  32. */
  33. virtual const char* GetTerseDocumentation()
  34. {
  35. return "Define and document custom properties.";
  36. }
  37. /**
  38. * Longer documentation.
  39. */
  40. virtual const char* GetFullDocumentation()
  41. {
  42. return
  43. " define_property(<GLOBAL | DIRECTORY | TARGET | SOURCE |\n"
  44. " TEST | VARIABLE | CACHED_VARIABLE>\n"
  45. " PROPERTY <name> [INHERITED]\n"
  46. " BRIEF_DOCS <brief-doc> [docs...]\n"
  47. " FULL_DOCS <full-doc> [docs...])\n"
  48. "Define one property in a scope for use with the "
  49. "set_property and get_property commands. "
  50. "This is primarily useful to associate documentation with property "
  51. "names that may be retrieved with the get_property command. "
  52. "The first argument determines the kind of scope in which the "
  53. "property should be used. It must be one of the following:\n"
  54. " GLOBAL = associated with the global namespace\n"
  55. " DIRECTORY = associated with one directory\n"
  56. " TARGET = associated with one target\n"
  57. " SOURCE = associated with one source file\n"
  58. " TEST = associated with a test named with add_test\n"
  59. " VARIABLE = documents a CMake language variable\n"
  60. " CACHED_VARIABLE = documents a CMake cache variable\n"
  61. "Note that unlike set_property and get_property no actual scope "
  62. "needs to be given; only the kind of scope is important.\n"
  63. "The required PROPERTY option is immediately followed by the name "
  64. "of the property being defined.\n"
  65. "If the INHERITED option then the get_property command will chain "
  66. "up to the next higher scope when the requested property is not "
  67. "set in the scope given to the command. "
  68. "DIRECTORY scope chains to GLOBAL. "
  69. "TARGET, SOURCE, and TEST chain to DIRECTORY.\n"
  70. "The BRIEF_DOCS and FULL_DOCS options are followed by strings to be "
  71. "associated with the property as its brief and full documentation. "
  72. "Corresponding options to the get_property command will retrieve the "
  73. "documentation.";
  74. }
  75. cmTypeMacro(cmDefinePropertyCommand, cmCommand);
  76. private:
  77. std::string PropertyName;
  78. std::string BriefDocs;
  79. std::string FullDocs;
  80. };
  81. #endif