VS: Add VS_GLOBAL_ROOTNAMESPACE target property

Add a setting for Visual Studio projects for the root namespace in the
"Globals" PropertyGroup section of the project file.
This commit is contained in:
John Farrier 2013-05-29 20:16:36 -04:00 committed by Brad King
parent 79ec7868d0
commit cca955a27c
2 changed files with 14 additions and 0 deletions

View File

@ -1302,6 +1302,11 @@ void cmTarget::DefineProperties(cmake *cm)
"project. Defaults to \"Win32Proj\". You may wish to override "
"this value with \"ManagedCProj\", for example, in a Visual "
"Studio managed C++ unit test project.");
cm->DefineProperty
("VS_GLOBAL_ROOTNAMESPACE", cmProperty::TARGET,
"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_REFERENCES", cmProperty::TARGET,
"Visual Studio managed project .NET references",

View File

@ -262,6 +262,15 @@ void cmVisualStudio10TargetGenerator::Generate()
"</Keyword>\n";
}
const char* vsGlobalRootNamespace =
this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE");
if(vsGlobalRootNamespace)
{
this->WriteString("<RootNamespace>", 2);
(*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalRootNamespace) <<
"</RootNamespace>\n";
}
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");