VS: Fix VS 10/11 .sln headers (#14038)

The VS version we generate in the .sln header is used by VS when opening
the file through Windows Explorer and possibly elsewhere.  Fix our
generators to use version strings known to VS to avoid a drop-down box.

For VS 10, since commit 4f96af44 (Fix VS 10 .sln files for Windows
Explorer, 2009-10-22) we use "Visual Studio 2010" instead of just
"Visual Studio 10".  This is correct except that for the Express edition
we need "Visual C++ Express 2010".

For VS 11, since commit f0d66ab4 (VS11: Fix comment generated at the top
of *.sln files, 2011-10-20) we use "Visual Studio 11" in the .sln header
but the preferred value is "Visual Studio 2012" (just as the first
commit mentioned above fixed for VS 10).  Also for the Express edition
we need "Visual Studio Express 2012 for Windows Desktop".
This commit is contained in:
Brad King 2013-03-25 13:30:46 -04:00
parent 1a60115bf5
commit c677838c1a
2 changed files with 16 additions and 2 deletions

View File

@ -102,8 +102,15 @@ void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
{ {
fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n";
if (this->ExpressEdition)
{
fout << "# Visual C++ Express 2010\n";
}
else
{
fout << "# Visual Studio 2010\n"; fout << "# Visual Studio 2010\n";
} }
}
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()

View File

@ -81,7 +81,14 @@ cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout)
{ {
fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n"; fout << "Microsoft Visual Studio Solution File, Format Version 12.00\n";
fout << "# Visual Studio 11\n"; if (this->ExpressEdition)
{
fout << "# Visual Studio Express 2012 for Windows Desktop\n";
}
else
{
fout << "# Visual Studio 2012\n";
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------