You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.0 KiB

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