summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-20 13:22:28 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-03-20 13:22:28 (GMT)
commit565213c1fd2d439ebb404cf26f9b1a5c9e9a60e1 (patch)
treeaf32db3ca040f681d8e828e5e8ec00fe25c74051 /Source
parentdf136e6c27d7430662eb11f5acd386927ad5e993 (diff)
parent98383f802aadcd2d469c4d7543e0a2abe8c3cdb9 (diff)
downloadCMake-565213c1fd2d439ebb404cf26f9b1a5c9e9a60e1.zip
CMake-565213c1fd2d439ebb404cf26f9b1a5c9e9a60e1.tar.gz
CMake-565213c1fd2d439ebb404cf26f9b1a5c9e9a60e1.tar.bz2
Merge topic 'configure_file-unicode'
98383f80 Unicode: check encoding of files given to configure_file.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmMakefile.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 93a06f0..f82acc8 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -3526,6 +3526,20 @@ int cmMakefile::ConfigureFile(const char* infile, const char* outfile,
return 0;
}
+ cmsys::FStream::BOM bom = cmsys::FStream::ReadBOM(fin);
+ if(bom != cmsys::FStream::BOM_None &&
+ bom != cmsys::FStream::BOM_UTF8)
+ {
+ cmOStringStream e;
+ e << "File starts with a Byte-Order-Mark that is not UTF-8:\n "
+ << sinfile;
+ this->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return 0;
+ }
+ // rewind to copy BOM to output file
+ fin.seekg(0);
+
+
// now copy input to output and expand variables in the
// input file at the same time
std::string inLine;