summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratedFileStream.h
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2001-06-04 15:34:22 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2001-06-04 15:34:22 (GMT)
commitb6d823a7c1573dd48a05269f27935646850dc485 (patch)
treedecd010a31e35efb77850a4b86f25539d31e4279 /Source/cmGeneratedFileStream.h
parenta3cfcd9894a5d626b8beba80fc8b5934ea3f46cf (diff)
downloadCMake-b6d823a7c1573dd48a05269f27935646850dc485.zip
CMake-b6d823a7c1573dd48a05269f27935646850dc485.tar.gz
CMake-b6d823a7c1573dd48a05269f27935646850dc485.tar.bz2
ENH: try to better handle control-c during make Makefiles
Diffstat (limited to 'Source/cmGeneratedFileStream.h')
-rw-r--r--Source/cmGeneratedFileStream.h28
1 files changed, 24 insertions, 4 deletions
diff --git a/Source/cmGeneratedFileStream.h b/Source/cmGeneratedFileStream.h
index 26c48d7..8607ad3 100644
--- a/Source/cmGeneratedFileStream.h
+++ b/Source/cmGeneratedFileStream.h
@@ -63,7 +63,8 @@ public:
m_Name(name),
m_TempName(m_Name+".tmp"),
m_Stream(m_TempName.c_str()),
- m_Copied(false)
+ m_Copied(false),
+ m_AlwaysCopy(false)
{}
/**
@@ -87,7 +88,11 @@ public:
* real file name to occur.
*/
void close() { this->DoCopy(); }
-
+ /**
+ * If always copy is true, then copy the file all the time without
+ * checking for differences. The default is false.
+ */
+ bool SetAlwaysCopy(bool v) { m_AlwaysCopy = v; return v;}
private:
/**
* The name of the real file where output will be copied if it has changed.
@@ -110,14 +115,29 @@ private:
bool m_Copied;
/**
- * Closes the temporary file and does the copy-if-different to the real file.
+ * If always copy is true, then copy the file all the time without
+ * checking for differences. The default is false.
+ */
+ bool m_AlwaysCopy;
+
+ /**
+ * Closes the temporary file and does the copy-if-different to the
+ * real file.
*/
void DoCopy()
{
if(!m_Copied)
{
m_Stream.close();
- cmSystemTools::CopyFileIfDifferent(m_TempName.c_str(), m_Name.c_str());
+ if(m_AlwaysCopy)
+ {
+ cmSystemTools::cmCopyFile(m_TempName.c_str(), m_Name.c_str());
+ }
+ else
+ {
+ cmSystemTools::CopyFileIfDifferent(m_TempName.c_str(),
+ m_Name.c_str());
+ }
cmSystemTools::RemoveFile(m_TempName.c_str());
m_Copied = true;
}