cmSetCommand.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. * This determines if the command is invoked when in script mode.
  43. */
  44. virtual bool IsScriptable() { return true; }
  45. /**
  46. * The name of the command as specified in CMakeList.txt.
  47. */
  48. virtual const char* GetName() {return "SET";}
  49. /**
  50. * Succinct documentation.
  51. */
  52. virtual const char* GetTerseDocumentation()
  53. {
  54. return "Set a CMAKE variable to a given value.";
  55. }
  56. /**
  57. * More documentation.
  58. */
  59. virtual const char* GetFullDocumentation()
  60. {
  61. return
  62. " SET(VAR [VALUE] [CACHE TYPE DOCSTRING [FORCE]])\n"
  63. "Within CMAKE sets VAR to the value VALUE. VALUE is expanded before VAR "
  64. "is set to it. If CACHE is present, then the VAR is put in the cache. "
  65. "TYPE and DOCSTRING are required. TYPE is used by the CMake GUI to "
  66. "choose a widget with which the user sets a value. The value for TYPE "
  67. "may be one of\n"
  68. " FILEPATH = File chooser dialog.\n"
  69. " PATH = Directory chooser dialog.\n"
  70. " STRING = Arbitrary string.\n"
  71. " BOOL = Boolean ON/OFF checkbox.\n"
  72. " INTERNAL = No GUI entry (used for persistent variables).\n"
  73. "If TYPE is INTERNAL, then the VALUE is always written into the cache, "
  74. "replacing any values existing in the cache. If it is not a CACHE VAR, "
  75. "then this always writes into the current makefile. The FORCE option "
  76. "will overwrite the CACHE value removing any changes by the USER.\n"
  77. " SET(VAR VALUE1 ... VALUEN).\n"
  78. "In this case VAR is set to a ; separated list of values.\n"
  79. "VAR can be an environment variable such as:\n"
  80. " SET( ENV{PATH} /home/martink )\n"
  81. "in which case the environment variable will be set.";
  82. }
  83. cmTypeMacro(cmSetCommand, cmCommand);
  84. };
  85. #endif