cmWriteFileCommand.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 cmWriteFileCommand_h
  14. #define cmWriteFileCommand_h
  15. #include "cmCommand.h"
  16. /** \class cmWriteFileCommand
  17. * \brief Writes a message to a file
  18. *
  19. */
  20. class cmWriteFileCommand : public cmCommand
  21. {
  22. public:
  23. /**
  24. * This is a virtual constructor for the command.
  25. */
  26. virtual cmCommand* Clone()
  27. {
  28. return new cmWriteFileCommand;
  29. }
  30. /**
  31. * This is called when the command is first encountered in
  32. * the CMakeLists.txt file.
  33. */
  34. virtual bool InitialPass(std::vector<std::string> const& args);
  35. /**
  36. * This determines if the command is invoked when in script mode.
  37. */
  38. virtual bool IsScriptable() { return true; }
  39. /**
  40. * The name of the command as specified in CMakeList.txt.
  41. */
  42. virtual const char* GetName() { return "WRITE_FILE";}
  43. /**
  44. * Succinct documentation.
  45. */
  46. virtual const char* GetTerseDocumentation()
  47. {
  48. return "Write a message to a file.";
  49. }
  50. /**
  51. * More documentation.
  52. */
  53. virtual const char* GetFullDocumentation()
  54. {
  55. return
  56. " WRITE_FILE(filename \"message to write\"... [APPEND])\n"
  57. "The first argument is the file name, the rest of the arguments are "
  58. "messages to write. If the argument APPEND is specified, then "
  59. "the message will be appended.\n"
  60. "NOTE 1: FILE WRITE and FILE APPEND do exactly the same as this one "
  61. "but add some more functionality.\n"
  62. "NOTE 2: When using WRITE_FILE the produced file cannot be used as an "
  63. "input to CMake (CONFIGURE_FILE, source file ...) because it will "
  64. "lead to infinite loop. Use CONFIGURE_FILE if you want to generate "
  65. "input files to CMake.";
  66. }
  67. cmTypeMacro(cmWriteFileCommand, cmCommand);
  68. };
  69. #endif