summaryrefslogtreecommitdiffstats
path: root/Source/cmWriteFileCommand.cxx
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2002-10-29 18:32:37 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2002-10-29 18:32:37 (GMT)
commit91bd2078123a417b74537652cffabab108ed15f3 (patch)
tree1a1784efc436b6f00ac65e8eab79977ba7d861f2 /Source/cmWriteFileCommand.cxx
parent74eeb49d4cd0962484ba5ed12c33edc33cec1d94 (diff)
downloadCMake-91bd2078123a417b74537652cffabab108ed15f3.zip
CMake-91bd2078123a417b74537652cffabab108ed15f3.tar.gz
CMake-91bd2078123a417b74537652cffabab108ed15f3.tar.bz2
Add flag to WRITE_FILE to append
Diffstat (limited to 'Source/cmWriteFileCommand.cxx')
-rw-r--r--Source/cmWriteFileCommand.cxx12
1 files changed, 10 insertions, 2 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: ",