[Cmake-commits] CMake branch, next, updated. v3.7.1-1742-g211f798

Brad King brad.king at kitware.com
Tue Dec 13 13:52:13 EST 2016


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, next has been updated
       via  211f798e466bc225dccd2aad89c3c24d02b66bdc (commit)
       via  55da7e501ef114a3eac835396dae2187b7af96e8 (commit)
      from  402bb3c1f1762f03d29e735a129ab9f6419e4d66 (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=211f798e466bc225dccd2aad89c3c24d02b66bdc
commit 211f798e466bc225dccd2aad89c3c24d02b66bdc
Merge: 402bb3c 55da7e5
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Dec 13 13:52:12 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Dec 13 13:52:12 2016 -0500

    Merge topic 'dotnet_hint_references' into next
    
    55da7e50 VS: add support for .NET references with hint paths


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=55da7e501ef114a3eac835396dae2187b7af96e8
commit 55da7e501ef114a3eac835396dae2187b7af96e8
Author:     Michael Stürmer <michael.stuermer at schaeffler.com>
AuthorDate: Tue Dec 13 08:49:39 2016 +0100
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Dec 13 13:51:50 2016 -0500

    VS: add support for .NET references with hint paths

diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index 2bbe2c3..971834e 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -274,7 +274,9 @@ Properties on Targets
    /prop_tgt/VS_CONFIGURATION_TYPE
    /prop_tgt/VS_DEBUGGER_WORKING_DIRECTORY
    /prop_tgt/VS_DESKTOP_EXTENSIONS_VERSION
+   /prop_tgt/VS_DOTNET_REFERENCE_refname
    /prop_tgt/VS_DOTNET_REFERENCES
+   /prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL
    /prop_tgt/VS_DOTNET_TARGET_FRAMEWORK_VERSION
    /prop_tgt/VS_GLOBAL_KEYWORD
    /prop_tgt/VS_GLOBAL_PROJECT_TYPES
diff --git a/Help/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL.rst b/Help/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL.rst
new file mode 100644
index 0000000..7641ba5
--- /dev/null
+++ b/Help/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL.rst
@@ -0,0 +1,7 @@
+VS_DOTNET_REFERENCES_COPY_LOCAL
+-------------------------------
+
+Sets the **Copy Local** property for all .NET hint references in the target
+
+Boolean property to enable/disable copying of .NET hint references to
+output directory. The default is ``ON``.
diff --git a/Help/prop_tgt/VS_DOTNET_REFERENCE_refname.rst b/Help/prop_tgt/VS_DOTNET_REFERENCE_refname.rst
new file mode 100644
index 0000000..5814005
--- /dev/null
+++ b/Help/prop_tgt/VS_DOTNET_REFERENCE_refname.rst
@@ -0,0 +1,12 @@
+VS_DOTNET_REFERENCE_<refname>
+-----------------------------
+
+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 :prop_tgt:`VS_DOTNET_REFERENCES` and
+:prop_tgt:`VS_DOTNET_REFERENCES_COPY_LOCAL`
diff --git a/Help/release/dev/vs-dotnet-references.rst b/Help/release/dev/vs-dotnet-references.rst
new file mode 100644
index 0000000..8998afb
--- /dev/null
+++ b/Help/release/dev/vs-dotnet-references.rst
@@ -0,0 +1,13 @@
+vs-dotnet-references
+--------------------
+
+* The :ref:`Visual Studio Generators` for VS 2010 and above can
+  now handle .NET references with hintpaths. For this the new
+  target property group :prop_tgt:`VS_DOTNET_REFERENCE_<refname>`
+  was introduced. The ``<refname>`` part of the property name will
+  be the name of the reference, the value will be the actual
+  path to the assembly.
+
+* Copying of referenced assemblies to the output directory can
+  now be disabled using the target property
+  :prop_tgt:`VS_DOTNET_REFERENCES_COPY_LOCAL`.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 8ab3b04..49274c0 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -429,28 +429,81 @@ void cmVisualStudio10TargetGenerator::Generate()
 void cmVisualStudio10TargetGenerator::WriteDotNetReferences()
 {
   std::vector<std::string> references;
+  typedef std::pair<std::string, std::string> HintReference;
+  std::vector<HintReference> hintReferences;
   if (const char* vsDotNetReferences =
         this->GeneratorTarget->GetProperty("VS_DOTNET_REFERENCES")) {
     cmSystemTools::ExpandListArgument(vsDotNetReferences, references);
   }
-  if (!references.empty()) {
+  cmPropertyMap const& props = this->GeneratorTarget->Target->GetProperties();
+  for (cmPropertyMap::const_iterator i = props.begin(); i != props.end();
+       ++i) {
+    if (i->first.find("VS_DOTNET_REFERENCE_") == 0) {
+      std::string name = i->first.substr(20);
+      if (name != "") {
+        std::string path = i->second.GetValue();
+        if (!cmsys::SystemTools::FileIsFullPath(path)) {
+          path = std::string(this->GeneratorTarget->Target->GetMakefile()
+                               ->GetCurrentSourceDirectory()) +
+            "/" + path;
+        }
+        this->ConvertToWindowsSlash(path);
+        hintReferences.push_back(HintReference(name, path));
+      }
+    }
+  }
+  if (!references.empty() || !hintReferences.empty()) {
     this->WriteString("<ItemGroup>\n", 1);
     for (std::vector<std::string>::iterator ri = references.begin();
          ri != references.end(); ++ri) {
-      this->WriteString("<Reference Include=\"", 2);
-      (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\">\n";
-      this->WriteString("<CopyLocalSatelliteAssemblies>true"
-                        "</CopyLocalSatelliteAssemblies>\n",
-                        3);
-      this->WriteString("<ReferenceOutputAssembly>true"
-                        "</ReferenceOutputAssembly>\n",
-                        3);
-      this->WriteString("</Reference>\n", 2);
+      // if the entry from VS_DOTNET_REFERENCES is an existing file, generate
+      // a new hint-reference and name it from the filename
+      if (cmsys::SystemTools::FileExists(*ri, true)) {
+        std::string name =
+          cmsys::SystemTools::GetFilenameWithoutExtension(*ri);
+        std::string path = *ri;
+        this->ConvertToWindowsSlash(path);
+        hintReferences.push_back(HintReference(name, path));
+      } else {
+        this->WriteDotNetReference(*ri, "");
+      }
+    }
+    for (std::vector<std::pair<std::string, std::string> >::const_iterator i =
+           hintReferences.begin();
+         i != hintReferences.end(); ++i) {
+      this->WriteDotNetReference(i->first, i->second);
     }
     this->WriteString("</ItemGroup>\n", 1);
   }
 }
 
+void cmVisualStudio10TargetGenerator::WriteDotNetReference(
+  std::string const& ref, std::string const& hint)
+{
+  this->WriteString("<Reference Include=\"", 2);
+  (*this->BuildFileStream) << cmVS10EscapeXML(ref) << "\">\n";
+  this->WriteString("<CopyLocalSatelliteAssemblies>true"
+                    "</CopyLocalSatelliteAssemblies>\n",
+                    3);
+  this->WriteString("<ReferenceOutputAssembly>true"
+                    "</ReferenceOutputAssembly>\n",
+                    3);
+  if (!hint.empty()) {
+    const char* privateReference = "True";
+    if (const char* value = this->GeneratorTarget->GetProperty(
+          "VS_DOTNET_REFERENCES_COPY_LOCAL")) {
+      if (cmSystemTools::IsOff(value)) {
+        privateReference = "False";
+      }
+    }
+    this->WriteString("<Private>", 3);
+    (*this->BuildFileStream) << privateReference << "</Private>\n";
+    this->WriteString("<HintPath>", 3);
+    (*this->BuildFileStream) << hint << "</HintPath>\n";
+  }
+  this->WriteString("</Reference>\n", 2);
+}
+
 void cmVisualStudio10TargetGenerator::WriteEmbeddedResourceGroup()
 {
   std::vector<cmSourceFile const*> resxObjs;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index e68bf1a..027761e 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -65,6 +65,7 @@ private:
                     std::vector<cmSourceFile const*> const&);
   void WriteAllSources();
   void WriteDotNetReferences();
+  void WriteDotNetReference(std::string const& ref, std::string const& hint);
   void WriteEmbeddedResourceGroup();
   void WriteWinRTReferences();
   void WriteWinRTPackageCertificateKeyFile();

-----------------------------------------------------------------------

Summary of changes:
 Help/manual/cmake-properties.7.rst                |    2 +
 Help/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL.rst |    7 ++
 Help/prop_tgt/VS_DOTNET_REFERENCE_refname.rst     |   12 ++++
 Help/release/dev/vs-dotnet-references.rst         |   13 ++++
 Source/cmVisualStudio10TargetGenerator.cxx        |   73 ++++++++++++++++++---
 Source/cmVisualStudio10TargetGenerator.h          |    1 +
 6 files changed, 98 insertions(+), 10 deletions(-)
 create mode 100644 Help/prop_tgt/VS_DOTNET_REFERENCES_COPY_LOCAL.rst
 create mode 100644 Help/prop_tgt/VS_DOTNET_REFERENCE_refname.rst
 create mode 100644 Help/release/dev/vs-dotnet-references.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list