cmSetCommand.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 cmSetCommand_h
  14. #define cmSetCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmSetCommand
  17. * \brief Set a CMAKE variable
  18. *
  19. * cmSetCommand sets a variable to a value with expansion.
  20. */
  21. class cmSetCommand : public cmCommand
  22. {
  23. public:
  24. /**
  25. * This is a virtual constructor for the command.
  26. */
  27. virtual cmCommand* Clone()
  28. {
  29. return new cmSetCommand;
  30. }
  31. /**
  32. * This is called when the command is first encountered in
  33. * the CMakeLists.txt file.
  34. */
  35. virtual bool InitialPass(std::vector<std::string> const& args);
  36. /**
  37. * This determines if the command gets propagated down
  38. * to makefiles located in subdirectories.
  39. */
  40. virtual bool IsInherited() {return true;}
  41. /**
  42. * The name of the command as specified in CMakeList.txt.
  43. */
  44. virtual const char* GetName() {return "SET";}
  45. /**
  46. * Succinct documentation.
  47. */
  48. virtual const char* GetTerseDocumentation()
  49. {
  50. return "Set a CMAKE variable to a given value.";
  51. }
  52. /**
  53. * More documentation.
  54. */
  55. virtual const char* GetFullDocumentation()
  56. {
  57. return
  58. " SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]])\n"
  59. "Within CMAKE sets VAR to the value VALUE. VALUE is expanded before VAR "
  60. "is set to it. If CACHE is present, then the VAR is put in the cache. "
  61. "TYPE and DOCSTRING are required. TYPE is used by the CMake GUI to "
  62. "choose a widget with which the user sets a value. The value for TYPE "
  63. "may be one of\n"
  64. " FILEPATH = File chooser dialog.\n"
  65. " PATH = Directory chooser dialog.\n"
  66. " STRING = Arbitrary string.\n"
  67. " BOOL = Boolean ON/OFF checkbox.\n"
  68. " INTERNAL = No GUI entry (used for persistent variables).\n"
  69. "If TYPE is INTERNAL, then the VALUE is always written into the cache, "
  70. "replacing any values existing in the cache. If it is not a CACHE VAR, "
  71. "then this always writes into the current makefile. The FORCE option "
  72. "will overwrite the CACHE value removing any changes by the USER.\n"
  73. " SET(VAR VALUE1 ... VALUEN).\n"
  74. "In this case VAR is set to a ; separated list of values.";
  75. }
  76. cmTypeMacro(cmSetCommand, cmCommand);
  77. };
  78. #endif