فهرست منبع

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.
Clinton Stimpson 10 سال پیش
والد
کامیت
61cf781a62
2فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 5 0
      Source/cmGlobalVisualStudio71Generator.cxx
  2. 5 0
      Source/cmGlobalVisualStudio7Generator.cxx

+ 5 - 0
Source/cmGlobalVisualStudio71Generator.cxx

@@ -93,6 +93,11 @@ void cmGlobalVisualStudio71Generator
                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);
 

+ 5 - 0
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);