1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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 cmConfigureFileCommand_h
13 #define cmConfigureFileCommand_h
15 #include "cmCommand.h"
17 class cmConfigureFileCommand : public cmCommand
20 cmTypeMacro(cmConfigureFileCommand, cmCommand);
22 virtual cmCommand* Clone()
24 return new cmConfigureFileCommand;
28 * This is called when the command is first encountered in
31 virtual bool InitialPass(std::vector<std::string> const& args,
32 cmExecutionStatus &status);
35 * The name of the command as specified in CMakeList.txt.
37 virtual const char* GetName() const { return "configure_file";}
40 * This determines if the command is invoked when in script mode.
42 virtual bool IsScriptable() const { return true; }
45 * Succinct documentation.
47 virtual const char* GetTerseDocumentation() const
49 return "Copy a file to another location and modify its contents.";
53 * Longer documentation.
55 virtual const char* GetFullDocumentation() const
58 " configure_file(<input> <output>\n"
59 " [COPYONLY] [ESCAPE_QUOTES] [@ONLY] \n"
60 " [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])\n"
61 "Copies a file <input> to file <output> and substitutes variable "
62 "values referenced in the file content. "
63 "If <input> is a relative path it is evaluated with respect to "
64 "the current source directory. "
65 "The <input> must be a file, not a directory. "
66 "If <output> is a relative path it is evaluated with respect to "
67 "the current binary directory. "
68 "If <output> names an existing directory the input file is placed "
69 "in that directory with its original name. "
71 "This command replaces any variables in the input file referenced as "
72 "${VAR} or @VAR@ with their values as determined by CMake. If a "
73 "variable is not defined, it will be replaced with nothing. "
74 "If COPYONLY is specified, then no variable expansion will take "
75 "place. If ESCAPE_QUOTES is specified then any substituted quotes "
76 "will be C-style escaped. "
77 "The file will be configured with the current values of CMake "
78 "variables. If @ONLY is specified, only variables "
79 "of the form @VAR@ will be replaces and ${VAR} will be ignored. "
80 "This is useful for configuring scripts that use ${VAR}. "
81 "Any occurrences of #cmakedefine VAR will be replaced with "
82 "either #define VAR or /* #undef VAR */ depending on "
83 "the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR "
84 "will be replaced with either #define VAR 1 or #define VAR 0 "
85 "depending on whether VAR evaluates to TRUE or FALSE in CMake.\n"
86 "With NEWLINE_STYLE the line ending could be adjusted: \n"
87 " 'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n"
88 "COPYONLY must not be used with NEWLINE_STYLE.\n";
91 virtual void FinalPass();
92 virtual bool HasFinalPass() const { return !this->Immediate; }
97 cmNewLineStyle NewLineStyle;
99 std::string InputFile;
100 std::string OutputFile;