Attached Files | VisualStudio10GeneratorProjectTypeAndDotNetReferenceSupport.patch [^] (3,634 bytes) 2011-11-20 01:19 [Show Content] [Hide Content]diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index fcb668a..8f7c322 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,6 +178,14 @@ 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 +211,18 @@ 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 +252,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteCustomCommands();
this->WriteObjSources();
this->WriteCLSources();
+ this->WriteDotNetReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -244,6 +264,36 @@ 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()
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index c3c27f4..6702509 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -47,6 +47,7 @@ private:
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteCLSources();
+ void WriteDotNetReferences();
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
VisualStudio10GeneratorProjectTypeAndDotNetReferenceSupportWithDocumentation.patch [^] (5,285 bytes) 2011-11-23 14:11 [Show Content] [Hide Content]diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index dad0353..d021990 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -1038,6 +1038,29 @@ void cmTarget::DefineProperties(cmake *cm)
"Can be set to change the visual studio source code control "
"auxpath property.");
cm->DefineProperty
+ ("VS_GLOBAL_PROJECT_TYPES", cmProperty::TARGET,
+ "Visual Studio project type(s).",
+ "Can be set to one or more UUIDs recognized by Visual Studio "
+ "to indicate the type of project. This value is copied "
+ "verbatim into the generated project file. Example for a "
+ "managed C++ unit testing project: \""
+ "{3AC096D0-A1C2-E12C-1390-A8335801FDAB};"
+ "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\". UUIDs are "
+ "semicolon-delimited.");
+ cm->DefineProperty
+ ("VS_GLOBAL_KEYWORD", cmProperty::TARGET,
+ "Visual Studio project keyword.",
+ "Sets the \"keyword\" attribute for a generated Visual Studio "
+ "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_DOTNET_REFERENCES", cmProperty::TARGET,
+ "Visual Studio managed project .NET references",
+ "Adds one or more semicolon-delimited .NET references to a "
+ "generated Visual Studio project. For example, \"System;"
+ "System.Windows.Forms\".");
+ cm->DefineProperty
("VS_GLOBAL_<variable>", cmProperty::TARGET,
"Visual Studio project-specific global variable.",
"Tell the Visual Studio generator to set the global variable "
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index fcb668a..8f7c322 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -178,6 +178,14 @@ 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 +211,18 @@ 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 +252,7 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteCustomCommands();
this->WriteObjSources();
this->WriteCLSources();
+ this->WriteDotNetReferences();
this->WriteProjectReferences();
this->WriteString(
"<Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\""
@@ -244,6 +264,36 @@ 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()
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index c3c27f4..6702509 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -47,6 +47,7 @@ private:
void WriteProjectConfigurations();
void WriteProjectConfigurationValues();
void WriteCLSources();
+ void WriteDotNetReferences();
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
|