summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-06-15 14:22:07 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-06-15 14:22:12 (GMT)
commitf3ffd18ab6ea78d6a13e83a4d890a619a5a2705c (patch)
tree8e05541c833ea7cd8f139f02eacdbbe4f0e751d8 /Source/cmVisualStudio10TargetGenerator.cxx
parent2afc4bf60843872e7d9fa883c61427facdbb4cae (diff)
parentc90630c501fed40078b280fe940535ff9545c2c9 (diff)
downloadCMake-f3ffd18ab6ea78d6a13e83a4d890a619a5a2705c.zip
CMake-f3ffd18ab6ea78d6a13e83a4d890a619a5a2705c.tar.gz
CMake-f3ffd18ab6ea78d6a13e83a4d890a619a5a2705c.tar.bz2
Merge topic 'vs_csharp_prop_for_all_extensions'
c90630c5 Vs: add support for VS_CSHARP_* target property for additional file extensions Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !961
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx68
1 files changed, 44 insertions, 24 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index d9b81a3..5a67477 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1595,6 +1595,10 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
toolHasSettings = true;
}
+ // Collect VS_CSHARP_* property values (if some are set)
+ std::map<std::string, std::string> sourceFileTags;
+ this->GetCSharpSourceProperties(sf, sourceFileTags);
+
if (this->NsightTegra) {
// Nsight Tegra needs specific file types to check up-to-dateness.
std::string name = cmSystemTools::LowerCase(sf->GetLocation().GetName());
@@ -1711,7 +1715,8 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
(*this->BuildFileStream) << cmVS10EscapeXML(includeInVsix)
<< "</IncludeInVSIX>\n";
}
-
+ // write source file specific tags
+ this->WriteCSharpSourceProperties(sourceFileTags);
this->WriteString("</", 2);
(*this->BuildFileStream) << tool << ">\n";
} else {
@@ -2047,34 +2052,13 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
sourceFileTags["Link"] = link;
}
}
- const cmPropertyMap& props = sf.GetProperties();
- for (cmPropertyMap::const_iterator p = props.begin(); p != props.end();
- ++p) {
- static const std::string propNamePrefix = "VS_CSHARP_";
- if (p->first.find(propNamePrefix.c_str()) == 0) {
- std::string tagName = p->first.substr(propNamePrefix.length());
- if (!tagName.empty()) {
- const std::string val = props.GetPropertyValue(p->first);
- if (!val.empty()) {
- sourceFileTags[tagName] = val;
- } else {
- sourceFileTags.erase(tagName);
- }
- }
- }
- }
+ this->GetCSharpSourceProperties(&sf, sourceFileTags);
// write source file specific tags
if (!sourceFileTags.empty()) {
hasFlags = true;
(*this->BuildFileStream) << firstString;
firstString = "";
- for (CsPropMap::const_iterator i = sourceFileTags.begin();
- i != sourceFileTags.end(); ++i) {
- this->WriteString("<", 3);
- (*this->BuildFileStream)
- << i->first << ">" << cmVS10EscapeXML(i->second) << "</" << i->first
- << ">\n";
- }
+ this->WriteCSharpSourceProperties(sourceFileTags);
}
}
@@ -4318,6 +4302,42 @@ bool cmVisualStudio10TargetGenerator::ForceOld(const std::string& source) const
return true;
}
+void cmVisualStudio10TargetGenerator::GetCSharpSourceProperties(
+ cmSourceFile const* sf, std::map<std::string, std::string>& tags)
+{
+ if (csproj == this->ProjectType) {
+ const cmPropertyMap& props = sf->GetProperties();
+ for (cmPropertyMap::const_iterator p = props.begin(); p != props.end();
+ ++p) {
+ static const std::string propNamePrefix = "VS_CSHARP_";
+ if (p->first.find(propNamePrefix.c_str()) == 0) {
+ std::string tagName = p->first.substr(propNamePrefix.length());
+ if (!tagName.empty()) {
+ const std::string val = props.GetPropertyValue(p->first);
+ if (!val.empty()) {
+ tags[tagName] = val;
+ } else {
+ tags.erase(tagName);
+ }
+ }
+ }
+ }
+ }
+}
+
+void cmVisualStudio10TargetGenerator::WriteCSharpSourceProperties(
+ const std::map<std::string, std::string>& tags)
+{
+ if (!tags.empty()) {
+ for (std::map<std::string, std::string>::const_iterator i = tags.begin();
+ i != tags.end(); ++i) {
+ this->WriteString("<", 3);
+ (*this->BuildFileStream) << i->first << ">" << cmVS10EscapeXML(i->second)
+ << "</" << i->first << ">\n";
+ }
+ }
+}
+
std::string cmVisualStudio10TargetGenerator::GetCMakeFilePath(
const char* relativeFilePath) const
{