diff options
author | Brad King <brad.king@kitware.com> | 2014-03-20 13:22:28 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-03-20 13:22:28 (GMT) |
commit | 565213c1fd2d439ebb404cf26f9b1a5c9e9a60e1 (patch) | |
tree | af32db3ca040f681d8e828e5e8ec00fe25c74051 /Source | |
parent | df136e6c27d7430662eb11f5acd386927ad5e993 (diff) | |
parent | 98383f802aadcd2d469c4d7543e0a2abe8c3cdb9 (diff) | |
download | CMake-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.cxx | 14 |
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; |