aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/vs2010backend.py
diff options
context:
space:
mode:
authorLuke Elliott <luke.b.elliott@gmail.com>2021-11-24 09:54:37 +0000
committerJussi Pakkanen <jpakkane@gmail.com>2021-11-27 20:06:54 +0200
commit26b102e817af99d8da55eecba09e8398ec0e3d88 (patch)
treef2daff6d0dcad85a1f432ef998fef1c96713cebf /mesonbuild/backend/vs2010backend.py
parent007c4659c2154755fc1f57d415afc8a736f81af2 (diff)
downloadmeson-26b102e817af99d8da55eecba09e8398ec0e3d88.zip
meson-26b102e817af99d8da55eecba09e8398ec0e3d88.tar.gz
meson-26b102e817af99d8da55eecba09e8398ec0e3d88.tar.bz2
Fix '# Visual Studio <>' comment in sln files with VS backend
such that Visual Studio Version Selector works.
Diffstat (limited to 'mesonbuild/backend/vs2010backend.py')
-rw-r--r--mesonbuild/backend/vs2010backend.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 1c0b9ad..7a56041 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -98,6 +98,8 @@ class Vs2010Backend(backends.Backend):
super().__init__(build, interpreter)
self.name = 'vs2010'
self.project_file_version = '10.0.30319.1'
+ self.sln_file_version = '11.00'
+ self.sln_version_comment = '2010'
self.platform_toolset = None
self.vs_version = '2010'
self.windows_target_platform_version = None
@@ -348,10 +350,11 @@ class Vs2010Backend(backends.Backend):
def generate_solution(self, sln_filename, projlist):
default_projlist = self.get_build_by_default_targets()
sln_filename_tmp = sln_filename + '~'
- with open(sln_filename_tmp, 'w', encoding='utf-8') as ofile:
- ofile.write('Microsoft Visual Studio Solution File, Format '
- 'Version 11.00\n')
- ofile.write('# Visual Studio ' + self.vs_version + '\n')
+ # Note using the utf-8 BOM requires the blank line, otherwise Visual Studio Version Selector fails.
+ # Without the BOM, VSVS fails if there is a blank line.
+ with open(sln_filename_tmp, 'w', encoding='utf-8-sig') as ofile:
+ ofile.write('\nMicrosoft Visual Studio Solution File, Format Version %s\n' % self.sln_file_version)
+ ofile.write('# Visual Studio %s\n' % self.sln_version_comment)
prj_templ = 'Project("{%s}") = "%s", "%s", "{%s}"\n'
for prj in projlist:
coredata = self.environment.coredata