diff options
author | Brad King <brad.king@kitware.com> | 2014-05-01 13:11:23 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-05-01 13:11:23 (GMT) |
commit | ecdc1985e3f404902849161f7f3fac08cda4c7ff (patch) | |
tree | 8b6bd34168ad2d341919685cabc18bb8c900ab8d /Source | |
parent | dc8505cad61dc5a9dc08b1d9ea2effe903ec240d (diff) | |
parent | 42e1cd137c0eff0297adaea5b34abca0da254eba (diff) | |
download | CMake-ecdc1985e3f404902849161f7f3fac08cda4c7ff.zip CMake-ecdc1985e3f404902849161f7f3fac08cda4c7ff.tar.gz CMake-ecdc1985e3f404902849161f7f3fac08cda4c7ff.tar.bz2 |
Merge topic 'file-generate-if-different'
42e1cd13 file(GENERATE): Only write the file if content is different.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.cxx | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 95a946a..01d31d3 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -13,6 +13,7 @@ #include "cmGeneratorExpressionEvaluationFile.h" #include "cmMakefile.h" +#include "cmGeneratedFileStream.h" #include <cmsys/FStream.hxx> #include <assert.h> @@ -79,19 +80,9 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config, this->Files.push_back(outputFileName); outputFiles[outputFileName] = outputContent; - cmsys::ofstream fout(outputFileName.c_str()); - - if(!fout) - { - cmOStringStream e; - e << "Evaluation file \"" << outputFileName << "\" cannot be written."; - this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str()); - return; - } - + cmGeneratedFileStream fout(outputFileName.c_str()); + fout.SetCopyIfDifferent(true); fout << outputContent; - - fout.close(); } //---------------------------------------------------------------------------- |