packaging: Initial packaging
[platform/upstream/cmake.git] / Source / cmWriteFileCommand.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4
5   Distributed under the OSI-approved BSD License (the "License");
6   see accompanying file Copyright.txt for details.
7
8   This software is distributed WITHOUT ANY WARRANTY; without even the
9   implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10   See the License for more information.
11 ============================================================================*/
12 #ifndef cmWriteFileCommand_h
13 #define cmWriteFileCommand_h
14
15 #include "cmCommand.h"
16
17 /** \class cmWriteFileCommand
18  * \brief Writes a message to a file
19  *
20  */
21 class cmWriteFileCommand : public cmCommand
22 {
23 public:
24   /**
25    * This is a virtual constructor for the command.
26    */
27   virtual cmCommand* Clone()
28     {
29     return new cmWriteFileCommand;
30     }
31
32   /**
33    * This is called when the command is first encountered in
34    * the CMakeLists.txt file.
35    */
36   virtual bool InitialPass(std::vector<std::string> const& args,
37                            cmExecutionStatus &status);
38
39   /**
40    * This determines if the command is invoked when in script mode.
41    */
42   virtual bool IsScriptable() const { return true; }
43
44   /**
45    * The name of the command as specified in CMakeList.txt.
46    */
47   virtual const char* GetName() const { return "write_file";}
48
49   /**
50    * Succinct documentation.
51    */
52   virtual const char* GetTerseDocumentation() const
53     {
54     return "Deprecated. Use the file(WRITE ) command instead.";
55     }
56
57   /**
58    * More documentation.
59    */
60   virtual const char* GetFullDocumentation() const
61     {
62     return
63       "  write_file(filename \"message to write\"... [APPEND])\n"
64       "The first argument is the file name, the rest of the arguments are "
65       "messages to write. If the argument APPEND is specified, then "
66       "the message will be appended.\n"
67       "NOTE 1: file(WRITE ... and file(APPEND ... do exactly the same as "
68       "this one but add some more functionality.\n"
69       "NOTE 2: When using write_file the produced file cannot be used as an "
70       "input to CMake (CONFIGURE_FILE, source file ...) because it will "
71       "lead to an infinite loop. Use configure_file if you want to generate "
72       "input files to CMake.";
73     }
74
75   /** This command is kept for compatibility with older CMake versions. */
76   virtual bool IsDiscouraged() const
77     {
78     return true;
79     }
80
81   cmTypeMacro(cmWriteFileCommand, cmCommand);
82 };
83
84
85 #endif