Merge topic 'sln-bom'

61cf781a Encoding:  Write Visual Studio solution file with BOM.
This commit is contained in:
Brad King 2015-01-11 12:00:26 -05:00 committed by CMake Topic Stage
commit 20d60c6361
2 changed files with 10 additions and 0 deletions

View File

@ -93,6 +93,11 @@ void cmGlobalVisualStudio71Generator
cmLocalGenerator* root, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators) std::vector<cmLocalGenerator*>& generators)
{ {
#ifdef CMAKE_ENCODING_UTF8
// Add UTF-8 BOM for .sln file to indicate encoding
const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
#endif
// Write out the header for a SLN file // Write out the header for a SLN file
this->WriteSLNHeader(fout); this->WriteSLNHeader(fout);

View File

@ -558,6 +558,11 @@ void cmGlobalVisualStudio7Generator
cmLocalGenerator* root, cmLocalGenerator* root,
std::vector<cmLocalGenerator*>& generators) std::vector<cmLocalGenerator*>& generators)
{ {
#ifdef CMAKE_ENCODING_UTF8
// Add UTF-8 BOM for .sln file to indicate encoding
const unsigned char utf8_bom[3] = {0xEF,0xBB,0xBF};
fout.write(reinterpret_cast<const char*>(utf8_bom), 3);
#endif
// Write out the header for a SLN file // Write out the header for a SLN file
this->WriteSLNHeader(fout); this->WriteSLNHeader(fout);