summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorClinton Stimpson <clinton@elemtech.com>2014-12-27 04:15:29 (GMT)
committerClinton Stimpson <clinton@elemtech.com>2014-12-27 04:15:29 (GMT)
commit61cf781a6216c55a60fb73d4fb5fab76b1e7fc34 (patch)
tree05c75a9af28e71ec5d291b21141a61489ae68bdd /Source/cmGlobalVisualStudio7Generator.cxx
parent05105d5c13f6662907cfb63fb6723f9f34f4558d (diff)
downloadCMake-61cf781a6216c55a60fb73d4fb5fab76b1e7fc34.zip
CMake-61cf781a6216c55a60fb73d4fb5fab76b1e7fc34.tar.gz
CMake-61cf781a6216c55a60fb73d4fb5fab76b1e7fc34.tar.bz2
Encoding: Write Visual Studio solution file with BOM.
When configured to use UTF-8 internally, add a UTF-8 BOM to generated .sln files for Visual Studio to correctly handle them. Otherwise, some versions of Visual Studio will read them as ANSI encoded files.
Diffstat (limited to 'Source/cmGlobalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 401e475..0eb7d2c 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -558,6 +558,11 @@ void cmGlobalVisualStudio7Generator
cmLocalGenerator* root,
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
this->WriteSLNHeader(fout);