summaryrefslogtreecommitdiff
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorAaron Ten Clay <aarontc@aarontc.com>2011-11-23 14:11:00 -0500
committerBrad King <brad.king@kitware.com>2011-11-28 11:44:04 -0500
commita1f976ce0e62baf513c8726c59aba5f75a0335c6 (patch)
tree0c65a5f56cc01d0d935bf26041eedda188cfcd0b /Source/cmVisualStudio10TargetGenerator.cxx
parent57a85237ac8ebc429ebe442897169bc9369e0380 (diff)
downloadcmake-a1f976ce0e62baf513c8726c59aba5f75a0335c6.tar.gz
VS: Add support for three new project properties (#12586)
VS_GLOBAL_PROJECT_TYPES: A string containing UUIDs to embed in the Visual Studio project file under <ProjectTypes>. VS_GLOBAL_KEYWORD: Allows specification of a keyword like "ManagedCProj" instead of the default "Win32Proj", under <Keyword> VS_DOTNET_REFERENCES: Semicolon-delimited list of .NET references to add to the project, which creates a new <ItemGroup>.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx57
1 files changed, 56 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index fcb668a378..a219ae923b 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,6 +178,15 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ProjectGUID>", 2);
(*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
+ const char* vsProjectTypes =
+ this->Target->GetProperty("VS_GLOBAL_PROJECT_TYPES");
+ if(vsProjectTypes)
+ {
+ this->WriteString("<ProjectTypes>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectTypes) <<
+ "</ProjectTypes>\n";
+ }
+
const char* vsProjectName = this->Target->GetProperty("VS_SCC_PROJECTNAME");
const char* vsLocalPath = this->Target->GetProperty("VS_SCC_LOCALPATH");
const char* vsProvider = this->Target->GetProperty("VS_SCC_PROVIDER");
@@ -203,7 +212,19 @@ void cmVisualStudio10TargetGenerator::Generate()
}
}
- this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
+ const char* vsGlobalKeyword =
+ this->Target->GetProperty("VS_GLOBAL_KEYWORD");
+ if(!vsGlobalKeyword)
+ {
+ this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<Keyword>", 2);
+ (*this->BuildFileStream) << cmVS10EscapeXML(vsGlobalKeyword) <<
+ "</Keyword>\n";
+ }
+
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
const char* projLabel = this->Target->GetProperty("PROJECT_LABEL");
@@ -233,6 +254,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteCustomCommands();
this->WriteObjSources();
this->WriteCLSources();
+ this->WriteDotNetReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -244,6 +266,39 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteGroups();
}
+void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
+{
+ const char* vsDotNetReferences
+ = this->Target->GetProperty("VS_DOTNET_REFERENCES");
+ if(vsDotNetReferences)
+ {
+ std::string references(vsDotNetReferences);
+ std::string::size_type position = 0;
+
+ this->WriteString("<ItemGroup>\n", 1);
+ while(references.length() > 0)
+ {
+ if((position = references.find(";")) == std::string::npos)
+ {
+ position = references.length() + 1;
+ }
+
+ this->WriteString("<Reference Include=\"", 2);
+ (*this->BuildFileStream) <<
+ cmVS10EscapeXML(references.substr(0, position)) << "\">\n";
+ this->WriteString("<CopyLocalSatelliteAssemblies>true"
+ "</CopyLocalSatelliteAssemblies>\n", 3);
+ this->WriteString("<ReferenceOutputAssembly>true"
+ "</ReferenceOutputAssembly>\n", 3);
+ this->WriteString("</Reference>\n", 2);
+
+ references.erase(0, position + 1);
+ }
+
+ this->WriteString("</ItemGroup>\n", 1);
+ }
+}
+
// ConfigurationType Application, Utility StaticLibrary DynamicLibrary
void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()