Merge topic 'vs2013_toolset_14369'

3064f80 VS: Generate ToolsVersion matching each VS version
This commit is contained in:
Brad King 2013-08-26 10:28:52 -04:00 committed by CMake Topic Stage
commit 4d5d8df0cd
3 changed files with 28 additions and 12 deletions

View File

@ -81,6 +81,9 @@ public:
void PathTooLong(cmTarget* target, cmSourceFile* sf, void PathTooLong(cmTarget* target, cmSourceFile* sf,
std::string const& sfRel); std::string const& sfRel);
virtual const char* GetToolsVersion() { return "4.0"; }
protected: protected:
virtual const char* GetIDEVersion() { return "10.0"; } virtual const char* GetIDEVersion() { return "10.0"; }

View File

@ -31,6 +31,11 @@ public:
/** TODO: VS 12 user macro support. */ /** TODO: VS 12 user macro support. */
virtual std::string GetUserMacrosDirectory() { return ""; } virtual std::string GetUserMacrosDirectory() { return ""; }
//in Visual Studio 2013 they detached the MSBuild tools version
//from the .Net Framework version and instead made it have it's own
//version number
virtual const char* GetToolsVersion() { return "12.0"; }
protected: protected:
virtual const char* GetIDEVersion() { return "12.0"; } virtual const char* GetIDEVersion() { return "12.0"; }
private: private:

View File

@ -216,12 +216,16 @@ void cmVisualStudio10TargetGenerator::Generate()
// Write the encoding header into the file // Write the encoding header into the file
char magic[] = {0xEF,0xBB, 0xBF}; char magic[] = {0xEF,0xBB, 0xBF};
this->BuildFileStream->write(magic, 3); this->BuildFileStream->write(magic, 3);
this->WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",0);
this->WriteString("<Project DefaultTargets=\"Build\" " //get the tools version to use
"ToolsVersion=\"4.0\" " const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
"xmlns=\"http://schemas.microsoft.com/" std::string project_defaults="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
"developer/msbuild/2003\">\n", project_defaults.append("<Project DefaultTargets=\"Build\" ToolsVersion=\"");
0); 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->WriteProjectConfigurations();
this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1); this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
this->WriteString("<ProjectGUID>", 2); this->WriteString("<ProjectGUID>", 2);
@ -716,12 +720,16 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
fout.write(magic, 3); fout.write(magic, 3);
cmGeneratedFileStream* save = this->BuildFileStream; cmGeneratedFileStream* save = this->BuildFileStream;
this->BuildFileStream = & fout; this->BuildFileStream = & fout;
this->WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<Project " //get the tools version to use
"ToolsVersion=\"4.0\" " const std::string toolsVer(this->GlobalGenerator->GetToolsVersion());
"xmlns=\"http://schemas.microsoft.com/" std::string project_defaults="<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
"developer/msbuild/2003\">\n", project_defaults.append("<Project ToolsVersion=\"");
0); 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(); for(ToolSourceMap::const_iterator ti = this->Tools.begin();
ti != this->Tools.end(); ++ti) ti != this->Tools.end(); ++ti)
{ {