Add label summary times to ctest default output. Also, remove parallel time output...
[cmake.git] / Source / cmFileCommand.h
blobe34f17e598bb3dd1cc4710cc74a660f25973fd3a
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmFileCommand.h,v $
5 Language: C++
6 Date: $Date: 2009-04-29 17:13:25 $
7 Version: $Revision: 1.47 $
9 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
10 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
16 =========================================================================*/
17 #ifndef cmFileCommand_h
18 #define cmFileCommand_h
20 #include "cmCommand.h"
22 struct cmFileInstaller;
24 /** \class cmFileCommand
25 * \brief Command for manipulation of files
28 class cmFileCommand : public cmCommand
30 public:
31 /**
32 * This is a virtual constructor for the command.
34 virtual cmCommand* Clone()
36 return new cmFileCommand;
39 /**
40 * This is called when the command is first encountered in
41 * the CMakeLists.txt file.
43 virtual bool InitialPass(std::vector<std::string> const& args,
44 cmExecutionStatus &status);
46 /**
47 * This determines if the command is invoked when in script mode.
49 virtual bool IsScriptable() { return true; }
51 /**
52 * The name of the command as specified in CMakeList.txt.
54 virtual const char* GetName() { return "file";}
56 /**
57 * Succinct documentation.
59 virtual const char* GetTerseDocumentation()
61 return "File manipulation command.";
64 /**
65 * More documentation.
67 virtual const char* GetFullDocumentation()
69 return
70 " file(WRITE filename \"message to write\"... )\n"
71 " file(APPEND filename \"message to write\"... )\n"
72 " file(READ filename variable [LIMIT numBytes] [OFFSET offset] [HEX])\n"
73 " file(STRINGS filename variable [LIMIT_COUNT num]\n"
74 " [LIMIT_INPUT numBytes] [LIMIT_OUTPUT numBytes]\n"
75 " [LENGTH_MINIMUM numBytes] [LENGTH_MAXIMUM numBytes]\n"
76 " [NEWLINE_CONSUME] [REGEX regex]\n"
77 " [NO_HEX_CONVERSION])\n"
78 " file(GLOB variable [RELATIVE path] [globbing expressions]...)\n"
79 " file(GLOB_RECURSE variable [RELATIVE path] \n"
80 " [FOLLOW_SYMLINKS] [globbing expressions]...)\n"
81 " file(RENAME <oldname> <newname>)\n"
82 " file(REMOVE [file1 ...])\n"
83 " file(REMOVE_RECURSE [file1 ...])\n"
84 " file(MAKE_DIRECTORY [directory1 directory2 ...])\n"
85 " file(RELATIVE_PATH variable directory file)\n"
86 " file(TO_CMAKE_PATH path result)\n"
87 " file(TO_NATIVE_PATH path result)\n"
88 " file(DOWNLOAD url file [TIMEOUT timeout] [STATUS status] [LOG log])\n"
89 "WRITE will write a message into a file called 'filename'. It "
90 "overwrites the file if it already exists, and creates the file "
91 "if it does not exist.\n"
92 "APPEND will write a message into a file same as WRITE, except "
93 "it will append it to the end of the file\n"
94 "READ will read the content of a file and store it into the "
95 "variable. It will start at the given offset and read up to numBytes. "
96 "If the argument HEX is given, the binary data will be converted to "
97 "hexadecimal representation and this will be stored in the variable.\n"
98 "STRINGS will parse a list of ASCII strings from a file and "
99 "store it in a variable. Binary data in the file are ignored. Carriage "
100 "return (CR) characters are ignored. It works also for Intel Hex and "
101 "Motorola S-record files, which are automatically converted to binary "
102 "format when reading them. Disable this using NO_HEX_CONVERSION.\n"
103 "LIMIT_COUNT sets the maximum number of strings to return. "
104 "LIMIT_INPUT sets the maximum number of bytes to read from "
105 "the input file. "
106 "LIMIT_OUTPUT sets the maximum number of bytes to store in the "
107 "output variable. "
108 "LENGTH_MINIMUM sets the minimum length of a string to return. "
109 "Shorter strings are ignored. "
110 "LENGTH_MAXIMUM sets the maximum length of a string to return. Longer "
111 "strings are split into strings no longer than the maximum length. "
112 "NEWLINE_CONSUME allows newlines to be included in strings instead "
113 "of terminating them.\n"
114 "REGEX specifies a regular expression that a string must match to be "
115 "returned. Typical usage \n"
116 " file(STRINGS myfile.txt myfile)\n"
117 "stores a list in the variable \"myfile\" in which each item is "
118 "a line from the input file.\n"
119 "GLOB will generate a list of all files that match the globbing "
120 "expressions and store it into the variable. Globbing expressions "
121 "are similar to regular expressions, but much simpler. If RELATIVE "
122 "flag is specified for an expression, the results will be returned "
123 "as a relative path to the given path.\n"
124 "Examples of globbing expressions include:\n"
125 " *.cxx - match all files with extension cxx\n"
126 " *.vt? - match all files with extension vta,...,vtz\n"
127 " f[3-5].txt - match files f3.txt, f4.txt, f5.txt\n"
128 "GLOB_RECURSE will generate a list similar to the regular GLOB, except "
129 "it will traverse all the subdirectories of the matched directory and "
130 "match the files. Subdirectories that are symlinks are only traversed "
131 "if FOLLOW_SYMLINKS is given or cmake policy CMP0009 is not set to NEW. "
132 "See cmake --help-policy CMP0009 for more information.\n"
133 "Examples of recursive globbing include:\n"
134 " /dir/*.py - match all python files in /dir and subdirectories\n"
135 "MAKE_DIRECTORY will create the given directories, also if their parent "
136 "directories don't exist yet\n"
137 "RENAME moves a file or directory within a filesystem, "
138 "replacing the destination atomically."
139 "\n"
140 "REMOVE will remove the given files, also in subdirectories\n"
141 "REMOVE_RECURSE will remove the given files and directories, also "
142 "non-empty directories\n"
143 "RELATIVE_PATH will determine relative path from directory to the given"
144 " file.\n"
145 "TO_CMAKE_PATH will convert path into a cmake style path with unix /. "
146 " The input can be a single path or a system path like \"$ENV{PATH}\". "
147 " Note the double quotes around the ENV call TO_CMAKE_PATH only takes "
148 " one argument.\n"
149 "TO_NATIVE_PATH works just like TO_CMAKE_PATH, but will convert from "
150 " a cmake style path into the native path style \\ for windows and / "
151 "for UNIX.\n"
152 "DOWNLOAD will download the given URL to the given file. "
153 "If LOG var is specified a log of the download will be put in var. "
154 "If STATUS var is specified the status of the operation will"
155 " be put in var. The status is returned in a list of length 2. "
156 "The first element is the numeric return value for the operation, "
157 "and the second element is a string value for the error. A 0 "
158 "numeric error means no error in the operation. "
159 "If TIMEOUT time is specified, the operation will "
160 "timeout after time seconds, time can be specified as a float."
161 "\n"
162 "The file() command also provides COPY and INSTALL signatures:\n"
163 " file(<COPY|INSTALL> files... DESTINATION <dir>\n"
164 " [FILE_PERMISSIONS permissions...]\n"
165 " [DIRECTORY_PERMISSIONS permissions...]\n"
166 " [NO_SOURCE_PERMISSIONS] [USE_SOURCE_PERMISSIONS]\n"
167 " [FILES_MATCHING]\n"
168 " [[PATTERN <pattern> | REGEX <regex>]\n"
169 " [EXCLUDE] [PERMISSIONS permissions...]] [...])\n"
170 "The COPY signature copies files, directories, and symlinks to a "
171 "destination folder. "
172 "Relative input paths are evaluated with respect to the current "
173 "source directory, and a relative destination is evaluated with "
174 "respect to the current build directory. "
175 "Copying preserves input file timestamps, and optimizes out a file "
176 "if it exists at the destination with the same timestamp. "
177 "Copying preserves input permissions unless explicit permissions or "
178 "NO_SOURCE_PERMISSIONS are given (default is USE_SOURCE_PERMISSIONS). "
179 "See the install(DIRECTORY) command for documentation of permissions, "
180 "PATTERN, REGEX, and EXCLUDE options. "
181 "\n"
182 "The INSTALL signature differs slightly from COPY: "
183 "it prints status messages, and NO_SOURCE_PERMISSIONS is default. "
184 "Installation scripts generated by the install() command use this "
185 "signature (with some undocumented options for internal use)."
186 // Undocumented INSTALL options:
187 // - RENAME <name>
188 // - OPTIONAL
189 // - FILES keyword to re-enter files... list
190 // - PERMISSIONS before REGEX is alias for FILE_PERMISSIONS
191 // - DIR_PERMISSIONS is alias for DIRECTORY_PERMISSIONS
192 // - TYPE <FILE|DIRECTORY|EXECUTABLE|PROGRAM|
193 // STATIC_LIBRARY|SHARED_LIBRARY|MODULE>
194 // - COMPONENTS, CONFIGURATIONS, PROPERTIES (ignored for compat)
198 cmTypeMacro(cmFileCommand, cmCommand);
200 protected:
201 bool HandleRename(std::vector<std::string> const& args);
202 bool HandleRemove(std::vector<std::string> const& args, bool recurse);
203 bool HandleWriteCommand(std::vector<std::string> const& args, bool append);
204 bool HandleReadCommand(std::vector<std::string> const& args);
205 bool HandleStringsCommand(std::vector<std::string> const& args);
206 bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse);
207 bool HandleMakeDirectoryCommand(std::vector<std::string> const& args);
209 bool HandleRelativePathCommand(std::vector<std::string> const& args);
210 bool HandleCMakePathCommand(std::vector<std::string> const& args,
211 bool nativePath);
212 bool HandleRPathChangeCommand(std::vector<std::string> const& args);
213 bool HandleRPathCheckCommand(std::vector<std::string> const& args);
214 bool HandleRPathRemoveCommand(std::vector<std::string> const& args);
215 bool HandleDifferentCommand(std::vector<std::string> const& args);
217 bool HandleCopyCommand(std::vector<std::string> const& args);
218 bool HandleInstallCommand(std::vector<std::string> const& args);
219 bool HandleDownloadCommand(std::vector<std::string> const& args);
223 #endif