VS: Add support for .NET target framework version

Teach CMake to generate the TargetFrameworkVersion XML node as
documented at

 http://msdn.microsoft.com/en-us/library/vstudio/ff770576.aspx

from target property VS_DOTNET_TARGET_FRAMEWORK_VERSION.
This commit is contained in:
Christian Maaser 2013-06-14 07:28:00 -04:00 committed by Brad King
parent 82771f1862
commit cfe6300a41
2 changed files with 12 additions and 0 deletions

View File

@ -1402,6 +1402,11 @@ void cmTarget::DefineProperties(cmake *cm)
"Visual Studio project root namespace.",
"Sets the \"RootNamespace\" attribute for a generated Visual Studio "
"project. The attribute will be generated only if this is set.");
cm->DefineProperty
("VS_DOTNET_TARGET_FRAMEWORK_VERSION", cmProperty::TARGET,
"Specify the .NET target framework version.",
"Used to specify the .NET target framework version for C++/CLI. "
"For example, \"v4.5\".");
cm->DefineProperty
("VS_DOTNET_REFERENCES", cmProperty::TARGET,
"Visual Studio managed project .NET references",

View File

@ -280,6 +280,13 @@ void cmVisualStudio10TargetGenerator::Generate()
}
this->WriteString("<ProjectName>", 2);
(*this->BuildFileStream) << projLabel << "</ProjectName>\n";
if(const char* targetFrameworkVersion = this->Target->GetProperty(
"VS_DOTNET_TARGET_FRAMEWORK_VERSION"))
{
this->WriteString("<TargetFrameworkVersion>", 2);
(*this->BuildFileStream) << targetFrameworkVersion
<< "</TargetFrameworkVersion>\n";
}
this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",