diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 7d25b91da..b14db43da 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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", diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index f8de3a8f6..2c9ec8ec0 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -280,6 +280,13 @@ void cmVisualStudio10TargetGenerator::Generate() } this->WriteString("", 2); (*this->BuildFileStream) << projLabel << "\n"; + if(const char* targetFrameworkVersion = this->Target->GetProperty( + "VS_DOTNET_TARGET_FRAMEWORK_VERSION")) + { + this->WriteString("", 2); + (*this->BuildFileStream) << targetFrameworkVersion + << "\n"; + } this->WriteString("\n", 1); this->WriteString("\n",