From cca955a27cf3fc8344ee3dce213472b61e1edef7 Mon Sep 17 00:00:00 2001 From: John Farrier Date: Wed, 29 May 2013 20:16:36 -0400 Subject: [PATCH] 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. --- Source/cmTarget.cxx | 5 +++++ Source/cmVisualStudio10TargetGenerator.cxx | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 66c22b16e..40c9798b0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -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", diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 933bf9573..61a34271d 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -262,6 +262,15 @@ void cmVisualStudio10TargetGenerator::Generate() "\n"; } + const char* vsGlobalRootNamespace = + this->Target->GetProperty("VS_GLOBAL_ROOTNAMESPACE"); + if(vsGlobalRootNamespace) + { + this->WriteString("", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalRootNamespace) << + "\n"; + } + this->WriteString("", 2); (*this->BuildFileStream) << this->Platform << "\n"; const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");