diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-10-29 18:32:37 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2002-10-29 18:32:37 (GMT) |
commit | 91bd2078123a417b74537652cffabab108ed15f3 (patch) | |
tree | 1a1784efc436b6f00ac65e8eab79977ba7d861f2 /Source | |
parent | 74eeb49d4cd0962484ba5ed12c33edc33cec1d94 (diff) | |
download | CMake-91bd2078123a417b74537652cffabab108ed15f3.zip CMake-91bd2078123a417b74537652cffabab108ed15f3.tar.gz CMake-91bd2078123a417b74537652cffabab108ed15f3.tar.bz2 |
Add flag to WRITE_FILE to append
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmWriteFileCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmWriteFileCommand.h | 6 |
2 files changed, 14 insertions, 4 deletions
diff --git a/Source/cmWriteFileCommand.cxx b/Source/cmWriteFileCommand.cxx index 7620b34..93ecd2d 100644 --- a/Source/cmWriteFileCommand.cxx +++ b/Source/cmWriteFileCommand.cxx @@ -30,14 +30,22 @@ bool cmWriteFileCommand::InitialPass(std::vector<std::string> const& argsIn) std::vector<std::string>::const_iterator i = args.begin(); std::string fileName = *i; + bool overwrite = true; i++; for(;i != args.end(); ++i) { - message += *i; + if ( *i == "APPEND" ) + { + overwrite = false; + } + else + { + message += *i; + } } - std::ofstream file(fileName.c_str(), std::ios::app); + std::ofstream file(fileName.c_str(), overwrite?std::ios::out : std::ios::app); if ( !file ) { cmSystemTools::Error("Internal CMake error when trying to open file: ", diff --git a/Source/cmWriteFileCommand.h b/Source/cmWriteFileCommand.h index 59b7ce4..5a07e3d 100644 --- a/Source/cmWriteFileCommand.h +++ b/Source/cmWriteFileCommand.h @@ -60,8 +60,10 @@ public: virtual const char* GetFullDocumentation() { return - "WRITE_FILE(filename \"message to write\"...)\n" - "The first argument is the file name, the rest of the arguments are messages to write."; + "WRITE_FILE(filename \"message to write\"... [APPEND])\n" + "The first argument is the file name, the rest of the arguments are " + "messages to write. If the argument APPEND is specified, then " + "the message will be appended."; } cmTypeMacro(cmWriteFileCommand, cmCommand); |