diff options
author | Robert Maynard <robert.maynard@kitware.com> | 2013-08-20 18:59:59 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-08-26 14:21:16 (GMT) |
commit | 3064f80d254fae7ce395bbd744133a53b11170f9 (patch) | |
tree | 9541cc6f82f9bee576d453dfd7ae2c307010b9dc /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | d7c9d60d9fa552a22944d9a912dd61539e012102 (diff) | |
download | CMake-3064f80d254fae7ce395bbd744133a53b11170f9.zip CMake-3064f80d254fae7ce395bbd744133a53b11170f9.tar.gz CMake-3064f80d254fae7ce395bbd744133a53b11170f9.tar.bz2 |
VS: Generate ToolsVersion matching each VS version
The MSBuild version for each Visual Studio generator isn't 4.0. With
Visual Studo 2013 the ToolsVersion moved from being tied to the .NET
framework and now has its own version number.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ea05347..a26b291 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -216,12 +216,16 @@ void cmVisualStudio10TargetGenerator::Generate() // Write the encoding header into the file char magic[] = {0xEF,0xBB, 0xBF}; this->BuildFileStream->write(magic, 3); - this->WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",0); - this->WriteString("<Project DefaultTargets=\"Build\" " - "ToolsVersion=\"4.0\" " - "xmlns=\"http://schemas.microsoft.com/" - "developer/msbuild/2003\">\n", - 0); + + //get the tools version to use + const std::string toolsVer(this->GlobalGenerator->GetToolsVersion()); + std::string project_defaults="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; + project_defaults.append("<Project DefaultTargets=\"Build\" ToolsVersion=\""); + project_defaults.append(toolsVer +"\" "); + project_defaults.append( + "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"); + this->WriteString(project_defaults.c_str(),0); + this->WriteProjectConfigurations(); this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1); this->WriteString("<ProjectGUID>", 2); @@ -716,12 +720,16 @@ void cmVisualStudio10TargetGenerator::WriteGroups() fout.write(magic, 3); cmGeneratedFileStream* save = this->BuildFileStream; this->BuildFileStream = & fout; - this->WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" - "<Project " - "ToolsVersion=\"4.0\" " - "xmlns=\"http://schemas.microsoft.com/" - "developer/msbuild/2003\">\n", - 0); + + //get the tools version to use + const std::string toolsVer(this->GlobalGenerator->GetToolsVersion()); + std::string project_defaults="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; + project_defaults.append("<Project ToolsVersion=\""); + project_defaults.append(toolsVer +"\" "); + project_defaults.append( + "xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"); + this->WriteString(project_defaults.c_str(),0); + for(ToolSourceMap::const_iterator ti = this->Tools.begin(); ti != this->Tools.end(); ++ti) { |