[Cmake-commits] CMake branch, master, updated. v3.9.0-rc3-78-gc8b4da5
Kitware Robot
kwrobot at kitware.com
Wed Jun 14 12:45:05 EDT 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, master has been updated
via c8b4da583878177099b3aa9c6eb895f968ccf11a (commit)
via 07ec212ae8d55cd20c315a8e73bd358762f3f959 (commit)
from b0835fefd27dbb261397ac9fe3b9ab49a107966c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c8b4da583878177099b3aa9c6eb895f968ccf11a
commit c8b4da583878177099b3aa9c6eb895f968ccf11a
Merge: b0835fe 07ec212
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Jun 14 16:43:24 2017 +0000
Commit: Kitware Robot <kwrobot at kitware.com>
CommitDate: Wed Jun 14 12:43:34 2017 -0400
Merge topic 'vs-dotnet-custom-reference-tags'
07ec212a VS: add target property VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
Acked-by: Kitware Robot <kwrobot at kitware.com>
Merge-request: !960
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=07ec212ae8d55cd20c315a8e73bd358762f3f959
commit 07ec212ae8d55cd20c315a8e73bd358762f3f959
Author: Michael Stürmer <michael.stuermer at schaeffler.com>
AuthorDate: Fri Apr 7 16:26:14 2017 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 13 10:46:31 2017 -0400
VS: add target property VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
Fixes: #16689
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index ec25596..94ab70c 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -291,6 +291,7 @@ Properties on Targets
/prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY
/prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION
/prop_tgt/VS_DOTNET_REFERENCE_refname
+ /prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname
/prop_tgt/VS_DOTNET_REFERENCES
/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL
/prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION
diff --git a/Help/prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst b/Help/prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst
new file mode 100644
index 0000000..478a04c
--- /dev/null
+++ b/Help/prop_tgt/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst
@@ -0,0 +1,11 @@
+VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>
+-----------------------------------------------
+
+Visual Studio managed project .NET reference with name ``<refname>``
+and hint path.
+
+Adds one .NET reference to generated Visual Studio project. The
+reference will have the name ``<refname>`` and will point to the
+assembly given as value of the property.
+
+See also the :prop_tgt:`VS_DOTNET_REFERENCE_<refname>` target property.
diff --git a/Help/release/dev/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst b/Help/release/dev/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst
new file mode 100644
index 0000000..0e258fd
--- /dev/null
+++ b/Help/release/dev/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst
@@ -0,0 +1,6 @@
+vs-dotnet-custom-reference-tags
+-------------------------------
+
+* The :prop_tgt:`VS_DOTNET_REFERENCEPROP_<refname>_TAG_<tagname>`
+ target property was added to support custom XML tags for reference
+ assemblies in C# targets.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 46c2894..21ff8ad 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 6106615..fd91c7e 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();
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 3af877f..6e7c2f3 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -4,3 +4,4 @@ run_cmake(VsTargetsFileReferences)
run_cmake(VsCustomProps)
run_cmake(VsDebuggerWorkingDir)
run_cmake(VsCSharpCustomTags)
+run_cmake(VsCSharpReferenceProps)
diff --git a/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake
new file mode 100644
index 0000000..8b9bb67
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake
@@ -0,0 +1,49 @@
+set(csProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.csproj")
+if(NOT EXISTS "${csProjectFile}")
+ set(RunCMake_TEST_FAILED "Project file ${csProjectFile} does not exist.")
+ return()
+endif()
+
+set(test1Reference "System")
+set(test1Tag "Hello")
+set(test1Value "World")
+
+set(test2Reference "foo2")
+set(test2Tag "Hallo")
+set(test2Value "Welt")
+
+set(tag1Found FALSE)
+set(ref1Found FALSE)
+
+file(STRINGS "${csProjectFile}" lines)
+
+foreach(i 1 2)
+ set(testReference "${test${i}Reference}")
+ set(testTag "${test${i}Tag}")
+ set(testValue "${test${i}Value}")
+ foreach(line IN LISTS lines)
+ if(line MATCHES "^ *<(Project|)Reference .*>$")
+ set(validTag FALSE)
+ if(line MATCHES "^ *<(Project|)Reference .*\".*${testReference}.*\".*>$")
+ set(validTag TRUE)
+ message(STATUS "foo.csproj is using reference ${testReference}")
+ set(ref${i}Found TRUE)
+ endif()
+ endif()
+ if(line MATCHES "^ *<${testTag}>${testValue}</${testTag}>$")
+ if(validTag)
+ message(STATUS "foo.csproj reference ${testReference} has tag ${testTag}")
+ set(tag${i}Found TRUE)
+ else()
+ message(STATUS "tag ${testTag} found in wrong place!")
+ set(tag${i}Found FALSE)
+ endif()
+ endif()
+ endforeach()
+endforeach()
+
+if(NOT tag1Found OR NOT ref1Found OR
+ NOT tag2Found OR NOT ref2Found)
+ set(RunCMake_TEST_FAILED "Custom reference XML tag not found.")
+ return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake
new file mode 100644
index 0000000..2af1756
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake
@@ -0,0 +1,19 @@
+enable_language(CSharp)
+add_library(foo foo.cs)
+add_library(foo2 foo.cs)
+
+set(test1Reference "System")
+set(test1Tag "Hello")
+set(test1Value "World")
+
+set(test2Reference "foo2")
+set(test2Tag "Hallo")
+set(test2Value "Welt")
+
+target_link_libraries(foo foo2)
+
+set_target_properties(foo PROPERTIES
+ VS_DOTNET_REFERENCES "${test1Reference};Blubb"
+ VS_DOTNET_REFERENCEPROP_${test1Reference}_TAG_${test1Tag} ${test1Value}
+ VS_DOTNET_REFERENCEPROP_${test2Reference}_TAG_${test2Tag} ${test2Value}
+ )
-----------------------------------------------------------------------
Summary of changes:
Help/manual/cmake-properties.7.rst | 1 +
...S_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst} | 7 ++-
...VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst | 6 +++
Source/cmVisualStudio10TargetGenerator.cxx | 31 +++++++++++++
Source/cmVisualStudio10TargetGenerator.h | 1 +
Tests/RunCMake/VS10Project/RunCMakeTest.cmake | 1 +
.../VS10Project/VsCSharpReferenceProps-check.cmake | 49 ++++++++++++++++++++
.../VS10Project/VsCSharpReferenceProps.cmake | 19 ++++++++
8 files changed, 111 insertions(+), 4 deletions(-)
copy Help/prop_tgt/{VS_DOTNET_REFERENCE_refname.rst => VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst} (60%)
create mode 100644 Help/release/dev/VS_DOTNET_REFERENCEPROP_refname_TAG_tagname.rst
create mode 100644 Tests/RunCMake/VS10Project/VsCSharpReferenceProps-check.cmake
create mode 100644 Tests/RunCMake/VS10Project/VsCSharpReferenceProps.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list