diff options
author | Michael Stürmer <michael.stuermer@schaeffler.com> | 2017-04-07 16:26:14 +0200 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-06-13 10:46:31 -0400 |
commit | 07ec212ae8d55cd20c315a8e73bd358762f3f959 (patch) | |
tree | d47f6899f2af29ceba31cd2cbb12ef67ecd25012 /Source | |
parent | 4ba2d2e3d76cb1ec04c612f9646c47d3f1231ad2 (diff) | |
download | cmake-07ec212ae8d55cd20c315a8e73bd358762f3f959.tar.gz |
VS: add target property VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
Fixes: #16689
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 31 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.h | 1 |
2 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 46c289476b..21ff8adcea 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -658,9 +658,39 @@ void cmVisualStudio10TargetGenerator::WriteDotNetReference( this->WriteString("<HintPath>", 3); (*this->BuildFileStream) << hint << "</HintPath>\n"; } + this->WriteDotNetReferenceCustomTags(ref); this->WriteString("</Reference>\n", 2); } +void cmVisualStudio10TargetGenerator::WriteDotNetReferenceCustomTags( + std::string const& ref) +{ + + static const std::string refpropPrefix = "VS_DOTNET_REFERENCEPROP_"; + static const std::string refpropInfix = "_TAG_"; + const std::string refPropFullPrefix = refpropPrefix + ref + refpropInfix; + typedef std::map<std::string, std::string> CustomTags; + CustomTags tags; + cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties(); + for (cmPropertyMap::const_iterator i = props.begin(); i != props.end(); + ++i) { + if (i->first.find(refPropFullPrefix) == 0) { + std::string refTag = i->first.substr(refPropFullPrefix.length()); + std::string refVal = i->second.GetValue(); + if (!refTag.empty() && !refVal.empty()) { + tags[refTag] = refVal; + } + } + } + for (CustomTags::const_iterator tag = tags.begin(); tag != tags.end(); + ++tag) { + this->WriteString("<", 3); + (*this->BuildFileStream) << tag->first << ">" + << cmVS10EscapeXML(tag->second) << "</" + << tag->first << ">\n"; + } +} + void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup() { std::vector<cmSourceFile const*> resxObjs; @@ -3493,6 +3523,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() (*this->BuildFileStream) << "</Project>\n"; this->WriteString("<Name>", 3); (*this->BuildFileStream) << name << "</Name>\n"; + this->WriteDotNetReferenceCustomTags(name); this->WriteString("</ProjectReference>\n", 2); } this->WriteString("</ItemGroup>\n", 1); diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 61066158c0..fd91c7ecb3 100644 --- a/Source/cmVisualStudio10TargetGenerator.h +++ b/Source/cmVisualStudio10TargetGenerator.h @@ -66,6 +66,7 @@ private: void WriteAllSources(); void WriteDotNetReferences(); void WriteDotNetReference(std::string const& ref, std::string const& hint); + void WriteDotNetReferenceCustomTags(std::string const& ref); void WriteEmbeddedResourceGroup(); void WriteWinRTReferences(); void WriteWinRTPackageCertificateKeyFile(); |