summaryrefslogtreecommitdiffstats
path: root/Source/cmUnixMakefileGenerator.cxx
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/cmUnixMakefileGenerator.cxx
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/cmUnixMakefileGenerator.cxx')
-rw-r--r--Source/cmUnixMakefileGenerator.cxx14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmUnixMakefileGenerator.cxx b/Source/cmUnixMakefileGenerator.cxx
index 73de1a4..5f8c399 100644
--- a/Source/cmUnixMakefileGenerator.cxx
+++ b/Source/cmUnixMakefileGenerator.cxx
@@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "cmSourceFile.h"
#include "cmMakeDepend.h"
#include "cmCacheManager.h"
+#include "cmGeneratedFileStream.h"
cmUnixMakefileGenerator::cmUnixMakefileGenerator()
{
@@ -93,7 +94,12 @@ void cmUnixMakefileGenerator::OutputMakefile(const char* file)
cmSystemTools::MakeDirectory(i->c_str());
}
}
- std::ofstream fout(file);
+ // Create a stream that writes to a temporary file
+ // then does a copy at the end. This is to allow users
+ // to hit control-c during the make of the makefile
+ cmGeneratedFileStream tempFile(file);
+ tempFile.SetAlwaysCopy(true);
+ std::ostream& fout = tempFile.GetStream();
if(!fout)
{
cmSystemTools::Error("Error can not open for write: ", file);
@@ -950,6 +956,12 @@ void cmUnixMakefileGenerator::OutputMakeRules(std::ostream& fout)
"${CMAKE_COMMAND}",
0,
"echo \"cmake might be out of date\"");
+ this->OutputMakeRule(fout,
+ "Rule to keep make from removing Makefiles "
+ "if control-C is hit during a run of cmake.",
+ ".PRECIOUS",
+ "Makefile cmake.depends",
+ 0);
}