mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
file(GENERATE): Only write the file if content is different.
No policy is used to control this behavior for now.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user