cmSetCommand.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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(<variable> <value> [CACHE <type> <docstring> [FORCE]])\n"
  58. "Within CMake sets <variable> to the value <value>. <value> is expanded"
  59. " before <variable> is set to it. If CACHE is present, then the "
  60. "<variable> is put in the cache. <type> and <docstring> are then "
  61. "required. <type> is used by the CMake GUI to choose a widget with "
  62. "which the user sets a value. The value for <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 "
  69. "cache, replacing any values existing in the cache. If it is not a "
  70. "cache 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(<variable> <value1> ... <valueN>)\n"
  74. "In this case <variable> is set to a semicolon separated list of "
  75. "values.\n"
  76. "<variable> can be an environment variable such as:\n"
  77. " set( ENV{PATH} /home/martink )\n"
  78. "in which case the environment variable will be set.";
  79. }
  80. cmTypeMacro(cmSetCommand, cmCommand);
  81. };
  82. #endif