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  971b392e59105b7c76a98628c3054c54b1a252e2 (commit)
       via  397b854620fc1ab3d8427ebeb5b7e4659c4f9128 (commit)
       via  a7dd8e669289e7b78ebc05b5d337052f32582038 (commit)
       via  6fda6005b306cc4a1e9e9e66d9cd4525fc623f73 (commit)
      from  fff9c79d71279e95d6ccf8535f3c6ecf125847b8 (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=971b392e59105b7c76a98628c3054c54b1a252e2
commit 971b392e59105b7c76a98628c3054c54b1a252e2
Merge: fff9c79 397b854
Author:     Brad King <brad.k...@kitware.com>
AuthorDate: Fri Jan 13 10:06:38 2017 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Fri Jan 13 10:06:38 2017 -0500

    Merge topic 'csharp_simple' into next
    
    397b8546 VS: added documentation for C# support
    a7dd8e66 VS: added support for C# (for Visual Studio 2010, 2012, 2013, 2015)
    6fda6005 VS: renamed target property VS_USER_PROPS_CXX to VS_USER_PROPS


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=397b854620fc1ab3d8427ebeb5b7e4659c4f9128
commit 397b854620fc1ab3d8427ebeb5b7e4659c4f9128
Author:     Michael Stürmer <michael.stuer...@schaeffler.com>
AuthorDate: Wed Jan 11 18:25:46 2017 +0100
Commit:     Michael Stürmer <michael.stuer...@schaeffler.com>
CommitDate: Fri Jan 13 09:28:14 2017 +0100

    VS: added documentation for C# support

diff --git a/Help/release/dev/vs-csharp-support.rst 
b/Help/release/dev/vs-csharp-support.rst
new file mode 100644
index 0000000..26d8574
--- /dev/null
+++ b/Help/release/dev/vs-csharp-support.rst
@@ -0,0 +1,25 @@
+vs-native-csharp-support
+------------------------
+
+* The :ref:`Visual Studio Generators` for VS 2010 and above
+  learned to support the C# language. C# assemblies and
+  programs can be added just like common C++ targets using
+  the :command:`add_library` and :command:`add_executable`
+  commands. Referencing between several C# targets in the same
+  source tree is done by :command:`target_link_libraries` like
+  for C++. Referencing to system or 3rd party assemblies is
+  done by the target properties :prop_tgt:`VS_DOTNET_REFERENCE_<refname>`
+  and :prop_tgt:`VS_DOTNET_REFERENCES`.
+
+* C# as a language can be enabled using :command:`enable_language`
+  or :command:`project` with ``CSharp``. It is not enabled by
+  default.
+
+* Flag variables, target properties and other configuration
+  that specifically targets C# contains ``CSharp`` as a part of
+  their names.
+
+* More finetuning of C# targets can be done using target
+  properties. Specifically the Visual Studio related target
+  properties (``VS_*``) are worth a look (for setting toolset
+  versions, root namespaces, assembly icons, ...).

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a7dd8e669289e7b78ebc05b5d337052f32582038
commit a7dd8e669289e7b78ebc05b5d337052f32582038
Author:     Michael Stürmer <michael.stuer...@schaeffler.com>
AuthorDate: Mon Jan 9 16:34:13 2017 +0100
Commit:     Michael Stürmer <michael.stuer...@schaeffler.com>
CommitDate: Fri Jan 13 09:28:13 2017 +0100

    VS: added support for C# (for Visual Studio 2010, 2012, 2013, 2015)

diff --git a/Modules/CMakeTestCSharpCompiler.cmake 
b/Modules/CMakeTestCSharpCompiler.cmake
index 21b7236..1a8bf32 100644
--- a/Modules/CMakeTestCSharpCompiler.cmake
+++ b/Modules/CMakeTestCSharpCompiler.cmake
@@ -34,10 +34,6 @@ if(NOT CMAKE_CSharp_COMPILER_WORKS)
   # Move result from cache to normal variable.
   set(CMAKE_CSharp_COMPILER_WORKS ${CMAKE_CSharp_COMPILER_WORKS})
   unset(CMAKE_CSharp_COMPILER_WORKS CACHE)
-  if(NOT CMAKE_CSharp_COMPILER_WORKS)
-    message("forcing compiler works to true (will be removed once C# support 
is integrated)")
-    set(CMAKE_CSharp_COMPILER_WORKS 1)
-  endif()
   set(CSharp_TEST_WAS_RUN 1)
 endif()
 
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index dff6ad6..89380eb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -130,9 +130,18 @@ void 
cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
   }
   stream->fill(' ');
   stream->width(indentLevel * 2);
-  (*stream) << "";
-  (*stream) << "<" << tag << " Condition=\"'$(Configuration)|$(Platform)'=='";
-  (*stream) << config << "|" << this->Platform << "'\"";
+  (*stream) << "<" << tag << " Condition=\"";
+  (*stream) << "'$(Configuration)|$(Platform)'=='";
+  (*stream) << config << "|" << this->Platform;
+  (*stream) << "'";
+  // handle special case for 32 bit C# targets
+  if (csproj == this->ProjectType && this->Platform == "Win32") {
+    (*stream) << " Or ";
+    (*stream) << "'$(Configuration)|$(Platform)'=='";
+    (*stream) << config << "|x86";
+    (*stream) << "'";
+  }
+  (*stream) << "\"";
   if (attribute) {
     (*stream) << attribute;
   }
@@ -159,6 +168,14 @@ void cmVisualStudio10TargetGenerator::WriteString(const 
char* line,
   "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"
 #define VS10_CXX_TARGETS "$(VCTargetsPath)\\Microsoft.Cpp.targets"
 
+#define VS10_CSharp_DEFAULT_PROPS                                             \
+  "$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props"
+// This does not seem to exist by default, it's just provided for consistency
+// in case users want to have default custom props for C# targets
+#define VS10_CSharp_USER_PROPS                                                \
+  "$(UserRootDir)\\Microsoft.CSharp.$(Platform).user.props"
+#define VS10_CSharp_TARGETS "$(MSBuildToolsPath)\\Microsoft.CSharp.targets"
+
 void cmVisualStudio10TargetGenerator::Generate()
 {
   // do not generate external ms projects
@@ -257,7 +274,9 @@ void cmVisualStudio10TargetGenerator::Generate()
     this->WriteString("</PropertyGroup>\n", 1);
   }
 
-  this->WriteProjectConfigurations();
+  if (csproj != this->ProjectType) {
+    this->WriteProjectConfigurations();
+  }
   this->WriteString("<PropertyGroup Label=\"Globals\">\n", 1);
   this->WriteString("<ProjectGUID>", 2);
   (*this->BuildFileStream) << "{" << this->GUID << "}</ProjectGUID>\n";
@@ -271,9 +290,14 @@ void cmVisualStudio10TargetGenerator::Generate()
   const char* vsProjectTypes =
     this->GeneratorTarget->GetProperty("VS_GLOBAL_PROJECT_TYPES");
   if (vsProjectTypes) {
-    this->WriteString("<ProjectTypes>", 2);
-    (*this->BuildFileStream) << cmVS10EscapeXML(vsProjectTypes)
-                             << "</ProjectTypes>\n";
+    std::string tagName = "ProjectTypes";
+    if (csproj == this->ProjectType) {
+      tagName = "ProjectTypeGuids";
+    }
+    this->WriteString("", 2);
+    (*this->BuildFileStream) << "<" << tagName << ">"
+                             << cmVS10EscapeXML(vsProjectTypes) << "</"
+                             << tagName << ">\n";
   }
 
   const char* vsProjectName =
@@ -371,10 +395,59 @@ void cmVisualStudio10TargetGenerator::Generate()
                              << "</" << globalKey << ">\n";
   }
 
+  if (this->Managed) {
+    std::string outputType = "<OutputType>";
+    switch (this->GeneratorTarget->GetType()) {
+      case cmStateEnums::OBJECT_LIBRARY:
+      case cmStateEnums::STATIC_LIBRARY:
+      case cmStateEnums::SHARED_LIBRARY:
+        outputType += "Library";
+        break;
+      case cmStateEnums::MODULE_LIBRARY:
+        outputType += "Module";
+        break;
+      case cmStateEnums::EXECUTABLE:
+        if (this->GeneratorTarget->Target->GetPropertyAsBool(
+              "WIN32_EXECUTABLE")) {
+          outputType += "WinExe";
+        } else {
+          outputType += "Exe";
+        }
+        break;
+      case cmStateEnums::UTILITY:
+      case cmStateEnums::GLOBAL_TARGET:
+        outputType += "Utility";
+        break;
+      case cmStateEnums::UNKNOWN_LIBRARY:
+      case cmStateEnums::INTERFACE_LIBRARY:
+        break;
+    }
+    outputType += "</OutputType>\n";
+    this->WriteString(outputType.c_str(), 2);
+    this->WriteString("<AppDesignerFolder>Properties</AppDesignerFolder>\n",
+                      2);
+  }
+
   this->WriteString("</PropertyGroup>\n", 1);
-  this->WriteString("<Import Project=\"" VS10_CXX_DEFAULT_PROPS "\" />\n", 1);
+
+  switch (this->ProjectType) {
+    case vcxproj:
+      this->WriteString("<Import Project=\"" VS10_CXX_DEFAULT_PROPS "\" />\n",
+                        1);
+      break;
+    case csproj:
+      this->WriteString("<Import Project=\"" VS10_CSharp_DEFAULT_PROPS "\" "
+                        "Condition=\"Exists('" VS10_CSharp_DEFAULT_PROPS "')\""
+                        "/>\n",
+                        1);
+      break;
+  }
+
   this->WriteProjectConfigurationValues();
-  this->WriteString("<Import Project=\"" VS10_CXX_PROPS "\" />\n", 1);
+
+  if (vcxproj == this->ProjectType) {
+    this->WriteString("<Import Project=\"" VS10_CXX_PROPS "\" />\n", 1);
+  }
   this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1);
   if (this->GlobalGenerator->IsMasmEnabled()) {
     this->WriteString("<Import Project=\"$(VCTargetsPath)\\"
@@ -384,16 +457,26 @@ void cmVisualStudio10TargetGenerator::Generate()
   this->WriteString("</ImportGroup>\n", 1);
   this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
   {
-    std::string props = VS10_CXX_USER_PROPS;
+    std::string props;
+    switch (this->ProjectType) {
+      case vcxproj:
+        props = VS10_CXX_USER_PROPS;
+        break;
+      case csproj:
+        props = VS10_CSharp_USER_PROPS;
+        break;
+    }
     if (const char* p = this->GeneratorTarget->GetProperty("VS_USER_PROPS")) {
       props = p;
+    }
+    if (!props.empty()) {
       this->ConvertToWindowsSlash(props);
+      this->WriteString("", 2);
+      (*this->BuildFileStream)
+        << "<Import Project=\"" << cmVS10EscapeXML(props) << "\""
+        << " Condition=\"exists('" << cmVS10EscapeXML(props) << "')\""
+        << " Label=\"LocalAppDataPlatform\" />\n";
     }
-    this->WriteString("", 2);
-    (*this->BuildFileStream)
-      << "<Import Project=\"" << cmVS10EscapeXML(props) << "\""
-      << " Condition=\"exists('" << cmVS10EscapeXML(props) << "')\""
-      << " Label=\"LocalAppDataPlatform\" />\n";
   }
   this->WritePlatformExtensions();
   this->WriteString("</ImportGroup>\n", 1);
@@ -409,7 +492,14 @@ void cmVisualStudio10TargetGenerator::Generate()
   this->WriteWinRTReferences();
   this->WriteProjectReferences();
   this->WriteSDKReferences();
-  this->WriteString("<Import Project=\"" VS10_CXX_TARGETS "\" />\n", 1);
+  switch (this->ProjectType) {
+    case vcxproj:
+      this->WriteString("<Import Project=\"" VS10_CXX_TARGETS "\" />\n", 1);
+      break;
+    case csproj:
+      this->WriteString("<Import Project=\"" VS10_CSharp_TARGETS "\" />\n", 1);
+      break;
+  }
 
   this->WriteTargetSpecificReferences();
   this->WriteString("<ImportGroup Label=\"ExtensionTargets\">\n", 1);
@@ -420,6 +510,17 @@ void cmVisualStudio10TargetGenerator::Generate()
                       2);
   }
   this->WriteString("</ImportGroup>\n", 1);
+  if (csproj == this->ProjectType) {
+    for (std::vector<std::string>::const_iterator i =
+           this->Configurations.begin();
+         i != this->Configurations.end(); ++i) {
+      this->WriteString("<PropertyGroup Condition=\"'$(Configuration)' == '",
+                        1);
+      (*this->BuildFileStream) << *i << "'\">\n";
+      this->WriteEvents(*i);
+      this->WriteString("</PropertyGroup>\n", 1);
+    }
+  }
   this->WriteString("</Project>", 0);
   // The groups are stored in a separate file for VS 10
   this->WriteGroups();
@@ -660,48 +761,55 @@ void 
cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
        i != this->Configurations.end(); ++i) {
     this->WritePlatformConfigTag("PropertyGroup", i->c_str(), 1,
                                  " Label=\"Configuration\"", "\n");
-    std::string configType = "<ConfigurationType>";
-    if (const char* vsConfigurationType =
-          this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) {
-      configType += cmVS10EscapeXML(vsConfigurationType);
-    } else {
-      switch (this->GeneratorTarget->GetType()) {
-        case cmStateEnums::SHARED_LIBRARY:
-        case cmStateEnums::MODULE_LIBRARY:
-          configType += "DynamicLibrary";
-          break;
-        case cmStateEnums::OBJECT_LIBRARY:
-        case cmStateEnums::STATIC_LIBRARY:
-          configType += "StaticLibrary";
-          break;
-        case cmStateEnums::EXECUTABLE:
-          if (this->NsightTegra &&
-              !this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) {
-            // Android executables are .so too.
+
+    if (csproj != this->ProjectType) {
+      std::string configType = "<ConfigurationType>";
+      if (const char* vsConfigurationType =
+            this->GeneratorTarget->GetProperty("VS_CONFIGURATION_TYPE")) {
+        configType += cmVS10EscapeXML(vsConfigurationType);
+      } else {
+        switch (this->GeneratorTarget->GetType()) {
+          case cmStateEnums::SHARED_LIBRARY:
+          case cmStateEnums::MODULE_LIBRARY:
             configType += "DynamicLibrary";
-          } else {
-            configType += "Application";
-          }
-          break;
-        case cmStateEnums::UTILITY:
-        case cmStateEnums::GLOBAL_TARGET:
-          if (this->NsightTegra) {
-            // Tegra-Android platform does not understand "Utility".
+            break;
+          case cmStateEnums::OBJECT_LIBRARY:
+          case cmStateEnums::STATIC_LIBRARY:
             configType += "StaticLibrary";
-          } else {
-            configType += "Utility";
-          }
-          break;
-        case cmStateEnums::UNKNOWN_LIBRARY:
-        case cmStateEnums::INTERFACE_LIBRARY:
-          break;
+            break;
+          case cmStateEnums::EXECUTABLE:
+            if (this->NsightTegra &&
+                !this->GeneratorTarget->GetPropertyAsBool("ANDROID_GUI")) {
+              // Android executables are .so too.
+              configType += "DynamicLibrary";
+            } else {
+              configType += "Application";
+            }
+            break;
+          case cmStateEnums::UTILITY:
+          case cmStateEnums::GLOBAL_TARGET:
+            if (this->NsightTegra) {
+              // Tegra-Android platform does not understand "Utility".
+              configType += "StaticLibrary";
+            } else {
+              configType += "Utility";
+            }
+            break;
+          case cmStateEnums::UNKNOWN_LIBRARY:
+          case cmStateEnums::INTERFACE_LIBRARY:
+            break;
+        }
       }
+      configType += "</ConfigurationType>\n";
+      this->WriteString(configType.c_str(), 2);
     }
-    configType += "</ConfigurationType>\n";
-    this->WriteString(configType.c_str(), 2);
 
     if (this->MSTools) {
-      this->WriteMSToolConfigurationValues(*i);
+      if (!this->Managed) {
+        this->WriteMSToolConfigurationValues(*i);
+      } else {
+        this->WriteMSToolConfigurationValuesManaged(*i);
+      }
     } else if (this->NsightTegra) {
       this->WriteNsightTegraConfigurationValues(*i);
     }
@@ -760,6 +868,61 @@ void 
cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
   }
 }
 
+void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValuesManaged(
+  std::string const& config)
+{
+  cmGlobalVisualStudio10Generator* gg =
+    static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
+
+  Options& o = *(this->ClOptions[config]);
+
+  if (o.IsDebug()) {
+    this->WriteString("<DebugSymbols>true</DebugSymbols>\n", 2);
+    this->WriteString("<DefineDebug>true</DefineDebug>\n", 2);
+  }
+
+  std::string outDir =
+    this->GeneratorTarget->GetDirectory(config.c_str()) + "/";
+  this->ConvertToWindowsSlash(outDir);
+  this->WriteString("<OutputPath>", 2);
+  (*this->BuildFileStream) << cmVS10EscapeXML(outDir) << "</OutputPath>\n";
+
+  if (o.HasFlag("Platform")) {
+    this->WriteString("<PlatformTarget>", 2);
+    (*this->BuildFileStream) << cmVS10EscapeXML(o.GetFlag("Platform"))
+                             << "</PlatformTarget>\n";
+    o.RemoveFlag("Platform");
+  }
+
+  if (const char* toolset = gg->GetPlatformToolset()) {
+    this->WriteString("<PlatformToolset>", 2);
+    (*this->BuildFileStream) << cmVS10EscapeXML(toolset)
+                             << "</PlatformToolset>\n";
+  }
+
+  std::string postfixName = cmSystemTools::UpperCase(config);
+  postfixName += "_POSTFIX";
+  std::string assemblyName =
+    this->GeneratorTarget->GetOutputName(config, false);
+  if (const char* postfix = this->GeneratorTarget->GetProperty(postfixName)) {
+    assemblyName += postfix;
+  }
+  this->WriteString("<AssemblyName>", 2);
+  (*this->BuildFileStream) << cmVS10EscapeXML(assemblyName)
+                           << "</AssemblyName>\n";
+
+  if (cmStateEnums::EXECUTABLE == this->GeneratorTarget->GetType()) {
+    this->WriteString("<StartAction>Program</StartAction>\n", 2);
+    this->WriteString("<StartProgram>", 2);
+    (*this->BuildFileStream) << cmVS10EscapeXML(outDir)
+                             << cmVS10EscapeXML(assemblyName)
+                             << ".exe</StartProgram>\n";
+  }
+
+  o.OutputFlagMap(*this->BuildFileStream, "    ");
+}
+
+//----------------------------------------------------------------------------
 void cmVisualStudio10TargetGenerator::WriteNsightTegraConfigurationValues(
   std::string const&)
 {
@@ -923,6 +1086,10 @@ void 
cmVisualStudio10TargetGenerator::ConvertToWindowsSlash(std::string& s)
 }
 void cmVisualStudio10TargetGenerator::WriteGroups()
 {
+  if (csproj == this->ProjectType) {
+    return;
+  }
+
   // collect up group information
   std::vector<cmSourceGroup> sourceGroups = this->Makefile->GetSourceGroups();
   std::vector<cmSourceFile*> classes;
@@ -1181,7 +1348,33 @@ void 
cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
   std::string shaderEntryPoint;
   std::string shaderModel;
   std::string shaderAdditionalFlags;
+  std::string sourceLink;
   std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
+  if (csproj == this->ProjectType) {
+    // EVERY extra source file must have a <Link>, otherwise it might not
+    // be visible in Visual Studio at all. The path relative to current
+    // source- or binary-dir is used within the link, if the file is
+    // in none of these paths, it is added with the plain filename without
+    // any path. This means the file will show up at root-level of the csproj
+    // (where CMakeLists.txt etc. are).
+    if (!this->InSourceBuild) {
+      toolHasSettings = true;
+      std::string fullFileName = sf->GetFullPath();
+      std::string srcDir = this->Makefile->GetCurrentSourceDirectory();
+      std::string binDir = this->Makefile->GetCurrentBinaryDirectory();
+      if (fullFileName.find(binDir) != std::string::npos) {
+        sourceLink = "";
+      } else if (fullFileName.find(srcDir) != std::string::npos) {
+        sourceLink = fullFileName.substr(srcDir.length() + 1);
+      } else {
+        // fallback: add plain filename without any path
+        sourceLink = cmsys::SystemTools::GetFilenameName(fullFileName);
+      }
+      if (!sourceLink.empty()) {
+        this->ConvertToWindowsSlash(sourceLink);
+      }
+    }
+  }
   if (ext == "hlsl") {
     tool = "FXCompile";
     // Figure out the type of shader compiler to use.
@@ -1302,6 +1495,10 @@ void 
cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
                                << "</AdditionalOptions>\n";
     }
+    if (!sourceLink.empty()) {
+      this->WriteString("<Link>", 3);
+      (*this->BuildFileStream) << cmVS10EscapeXML(sourceLink) << "</Link>\n";
+    }
     this->WriteString("</", 2);
     (*this->BuildFileStream) << tool << ">\n";
   } else {
@@ -1343,6 +1540,12 @@ void 
cmVisualStudio10TargetGenerator::WriteSource(std::string const& tool,
       this->GlobalGenerator->PathTooLong(this->GeneratorTarget, sf, sourceRel);
     }
   }
+  if (csproj == this->ProjectType && this->InSourceBuild) {
+    std::string srcdir = this->Makefile->GetCurrentSourceDirectory();
+    if (sourceFile.find(srcdir) != std::string::npos) {
+      sourceFile = sourceFile.substr(srcdir.size() + 1);
+    }
+  }
   this->ConvertToWindowsSlash(sourceFile);
   this->WriteString("<", 2);
   (*this->BuildFileStream) << tool << " Include=\""
@@ -1393,6 +1596,8 @@ void cmVisualStudio10TargetGenerator::WriteAllSources()
       tool = "MASM";
     } else if (lang == "RC") {
       tool = "ResourceCompile";
+    } else if (lang == "CSharp") {
+      tool = "Compile";
     }
 
     if (!tool.empty()) {
@@ -1596,6 +1801,37 @@ bool 
cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
     std::string xamlFileName = fileName.substr(0, fileName.find_last_of("."));
     (*this->BuildFileStream) << xamlFileName << "</DependentUpon>\n";
   }
+  if (csproj == this->ProjectType) {
+    std::string f = source->GetFullPath();
+    typedef std::map<std::string, std::string> CsPropMap;
+    CsPropMap sourceFileTags;
+    // set <Link> tag if necessary
+    if (!this->InSourceBuild) {
+      const std::string stripFromPath =
+        this->Makefile->GetCurrentSourceDirectory();
+      if (f.find(stripFromPath) != std::string::npos) {
+        std::string link = f.substr(stripFromPath.length() + 1);
+        this->ConvertToWindowsSlash(link);
+        sourceFileTags["Link"] = link;
+      }
+    }
+    //
+    // NOTE: in future commits additional props will be added!
+    //
+    // 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("<", 2);
+        (*this->BuildFileStream)
+          << i->first << ">" << cmVS10EscapeXML(i->second) << "</" << i->first
+          << ">\n";
+      }
+    }
+  }
 
   return hasFlags;
 }
@@ -1606,6 +1842,9 @@ void 
cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
   if (ttype > cmStateEnums::GLOBAL_TARGET) {
     return;
   }
+  if (csproj == this->ProjectType) {
+    return;
+  }
 
   this->WriteString("<PropertyGroup>\n", 2);
   this->WriteString("<_ProjectFileVersion>10.0.20506.1"
@@ -1680,6 +1919,9 @@ void 
cmVisualStudio10TargetGenerator::OutputLinkIncremental(
   if (!this->MSTools) {
     return;
   }
+  if (csproj == this->ProjectType) {
+    return;
+  }
   // static libraries and things greater than modules do not need
   // to set this option
   if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
@@ -1734,8 +1976,18 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
 
   cmGlobalVisualStudio10Generator* gg =
     static_cast<cmGlobalVisualStudio10Generator*>(this->GlobalGenerator);
-  CM_AUTO_PTR<Options> pOptions(new Options(
-    this->LocalGenerator, Options::Compiler, gg->GetClFlagTable()));
+  CM_AUTO_PTR<Options> pOptions;
+  switch (this->ProjectType) {
+    case vcxproj:
+      pOptions = CM_AUTO_PTR<Options>(new Options(
+        this->LocalGenerator, Options::Compiler, gg->GetClFlagTable()));
+      break;
+    case csproj:
+      pOptions = CM_AUTO_PTR<Options>(new Options(this->LocalGenerator,
+                                                  Options::CSharpCompiler,
+                                                  gg->GetCSharpFlagTable()));
+      break;
+  }
   Options& clOptions = *pOptions;
 
   std::string flags;
@@ -1748,7 +2000,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
     return false;
   }
   if (linkLanguage == "C" || linkLanguage == "CXX" ||
-      linkLanguage == "Fortran") {
+      linkLanguage == "Fortran" || linkLanguage == "CSharp") {
     std::string baseFlagVar = "CMAKE_";
     baseFlagVar += linkLanguage;
     baseFlagVar += "_FLAGS";
@@ -1776,16 +2028,26 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
   std::string defineFlags =
     this->GeneratorTarget->Target->GetMakefile()->GetDefineFlags();
   if (this->MSTools) {
-    clOptions.FixExceptionHandlingDefault();
-    clOptions.AddFlag("PrecompiledHeader", "NotUsing");
-    std::string asmLocation = configName + "/";
-    clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
+    if (vcxproj == this->ProjectType) {
+      clOptions.FixExceptionHandlingDefault();
+      clOptions.AddFlag("PrecompiledHeader", "NotUsing");
+      std::string asmLocation = configName + "/";
+      clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
+    }
   }
   clOptions.Parse(flags.c_str());
   clOptions.Parse(defineFlags.c_str());
   std::vector<std::string> targetDefines;
-  this->GeneratorTarget->GetCompileDefinitions(targetDefines,
-                                               configName.c_str(), "CXX");
+  switch (this->ProjectType) {
+    case vcxproj:
+      this->GeneratorTarget->GetCompileDefinitions(targetDefines,
+                                                   configName.c_str(), "CXX");
+      break;
+    case csproj:
+      this->GeneratorTarget->GetCompileDefinitions(
+        targetDefines, configName.c_str(), "CSharp");
+      break;
+  }
   clOptions.AddDefines(targetDefines);
   if (this->MSTools) {
     clOptions.SetVerboseMakefile(
@@ -1840,6 +2102,9 @@ void cmVisualStudio10TargetGenerator::WriteClOptions(
   std::string const& configName, std::vector<std::string> const& includes)
 {
   Options& clOptions = *(this->ClOptions[configName]);
+  if (this->ProjectType == csproj) {
+    return;
+  }
   this->WriteString("<ClCompile>\n", 2);
   clOptions.OutputAdditionalOptions(*this->BuildFileStream, "      ", "");
   clOptions.AppendFlag("AdditionalIncludeDirectories", includes);
@@ -2508,6 +2773,9 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(
       this->GeneratorTarget->GetType() > cmStateEnums::MODULE_LIBRARY) {
     return;
   }
+  if (csproj == this->ProjectType) {
+    return;
+  }
   Options& linkOptions = *(this->LinkOptions[config]);
   this->WriteString("<Link>\n", 2);
 
@@ -2575,6 +2843,9 @@ void cmVisualStudio10TargetGenerator::WriteMidlOptions(
   if (!this->MSTools) {
     return;
   }
+  if (csproj == this->ProjectType) {
+    return;
+  }
 
   // This processes *any* of the .idl files specified in the project's file
   // list (and passed as the item metadata %(Filename) expressing the rule
@@ -2636,7 +2907,9 @@ void 
cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups()
     //    output midl flags       <Midl></Midl>
     this->WriteMidlOptions(*i, includes);
     // write events
-    this->WriteEvents(*i);
+    if (csproj != this->ProjectType) {
+      this->WriteEvents(*i);
+    }
     //    output link flags       <Link></Link>
     this->WriteLinkOptions(*i);
     //    output lib flags       <Lib></Lib>
@@ -2702,12 +2975,20 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
     script += cmVS10EscapeXML(lg->ConstructScript(ccg));
   }
   comment = cmVS10EscapeComment(comment);
-  this->WriteString("<Message>", 3);
-  (*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
-  this->WriteString("<Command>", 3);
+  if (csproj != this->ProjectType) {
+    this->WriteString("<Message>", 3);
+    (*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
+    this->WriteString("<Command>", 3);
+  } else {
+    if (!comment.empty()) {
+      (*this->BuildFileStream) << "echo " << cmVS10EscapeXML(comment) << "\n";
+    }
+  }
   (*this->BuildFileStream) << script;
-  (*this->BuildFileStream) << "</Command>"
-                           << "\n";
+  if (csproj != this->ProjectType) {
+    (*this->BuildFileStream) << "</Command>";
+  }
+  (*this->BuildFileStream) << "\n";
   this->WriteString("</", 2);
   (*this->BuildFileStream) << name << ">\n";
 }
@@ -2732,6 +3013,10 @@ void 
cmVisualStudio10TargetGenerator::WriteProjectReferences()
           ->TargetIsFortranOnly(dt)) {
       continue;
     }
+    if (csproj == this->ProjectType &&
+        !this->GlobalGenerator->TargetIsCSharpOnly(dt)) {
+      continue;
+    }
     this->WriteString("<ProjectReference Include=\"", 2);
     cmLocalGenerator* lg = dt->GetLocalGenerator();
     std::string name = dt->GetName();
@@ -2748,8 +3033,16 @@ void 
cmVisualStudio10TargetGenerator::WriteProjectReferences()
     this->ConvertToWindowsSlash(path);
     (*this->BuildFileStream) << cmVS10EscapeXML(path) << "\">\n";
     this->WriteString("<Project>", 3);
-    (*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str())
-                             << "</Project>\n";
+    if (csproj == this->ProjectType) {
+      (*this->BuildFileStream) << "{";
+    }
+    (*this->BuildFileStream) << this->GlobalGenerator->GetGUID(name.c_str());
+    if (csproj == this->ProjectType) {
+      (*this->BuildFileStream) << "}";
+    }
+    (*this->BuildFileStream) << "</Project>\n";
+    this->WriteString("<Name>", 3);
+    (*this->BuildFileStream) << name << "</Name>\n";
     this->WriteString("</ProjectReference>\n", 2);
   }
   this->WriteString("</ItemGroup>\n", 1);
diff --git a/Source/cmVisualStudio10TargetGenerator.h 
b/Source/cmVisualStudio10TargetGenerator.h
index 027761e..45464c0 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -56,6 +56,7 @@ private:
   void WriteProjectConfigurations();
   void WriteProjectConfigurationValues();
   void WriteMSToolConfigurationValues(std::string const& config);
+  void WriteMSToolConfigurationValuesManaged(std::string const& config);
   void WriteHeaderSource(cmSourceFile const* sf);
   void WriteExtraSource(cmSourceFile const* sf);
   void WriteNsightTegraConfigurationValues(std::string const& config);
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 73eef9a..4945b31 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -325,6 +325,9 @@ if(BUILD_TESTING)
     endif()
   endif()
 
+  if(${CMAKE_GENERATOR} MATCHES "Visual Studio ([^789]|[789][0-9])")
+    ADD_TEST_MACRO(CSharpOnly CSharpOnly)
+  endif()
 
   ADD_TEST_MACRO(COnly COnly)
   ADD_TEST_MACRO(CxxOnly CxxOnly)
diff --git a/Tests/CSharpOnly/CMakeLists.txt b/Tests/CSharpOnly/CMakeLists.txt
new file mode 100644
index 0000000..0e3e39e
--- /dev/null
+++ b/Tests/CSharpOnly/CMakeLists.txt
@@ -0,0 +1,10 @@
+# a simple CSharp only test case
+project (CSharpOnly CSharp)
+
+# C# does not make any difference between STATIC and SHARED libs
+add_library(lib1 STATIC lib1.cs)
+add_library(lib2 SHARED lib2.cs)
+
+add_executable(CSharpOnly csharponly.cs)
+
+target_link_libraries(CSharpOnly lib1 lib2)
diff --git a/Tests/CSharpOnly/csharponly.cs b/Tests/CSharpOnly/csharponly.cs
new file mode 100644
index 0000000..ad4641a
--- /dev/null
+++ b/Tests/CSharpOnly/csharponly.cs
@@ -0,0 +1,15 @@
+namespace CSharpOnly
+{
+    class CSharpOnly
+    {
+        public static void Main(string[] args)
+        {
+            int val = Lib1.getResult();
+
+            Lib2 l = new Lib2();
+            val = l.myVal;
+
+            return;
+        }
+    }
+}
diff --git a/Tests/CSharpOnly/lib1.cs b/Tests/CSharpOnly/lib1.cs
new file mode 100644
index 0000000..7a7ae10
--- /dev/null
+++ b/Tests/CSharpOnly/lib1.cs
@@ -0,0 +1,10 @@
+namespace CSharpOnly
+{
+    public class Lib1
+    {
+        public static int getResult()
+        {
+            return 23;
+        }
+    }
+}
diff --git a/Tests/CSharpOnly/lib2.cs b/Tests/CSharpOnly/lib2.cs
new file mode 100644
index 0000000..b4b38ce
--- /dev/null
+++ b/Tests/CSharpOnly/lib2.cs
@@ -0,0 +1,10 @@
+namespace CSharpOnly
+{
+    public class Lib2
+    {
+        public int myVal = 42;
+
+        public Lib2()
+        {}
+    }
+}

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=6fda6005b306cc4a1e9e9e66d9cd4525fc623f73
commit 6fda6005b306cc4a1e9e9e66d9cd4525fc623f73
Author:     Michael Stürmer <michael.stuer...@schaeffler.com>
AuthorDate: Mon Jan 9 16:32:22 2017 +0100
Commit:     Michael Stürmer <michael.stuer...@schaeffler.com>
CommitDate: Fri Jan 13 09:27:21 2017 +0100

    VS: renamed target property VS_USER_PROPS_CXX to VS_USER_PROPS

diff --git a/Help/manual/cmake-properties.7.rst 
b/Help/manual/cmake-properties.7.rst
index c93ace1..864d1dc 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -291,7 +291,7 @@ Properties on Targets
    /prop_tgt/VS_SCC_PROJECTNAME
    /prop_tgt/VS_SCC_PROVIDER
    /prop_tgt/VS_SDK_REFERENCES
-   /prop_tgt/VS_USER_PROPS_CXX
+   /prop_tgt/VS_USER_PROPS
    /prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
    /prop_tgt/VS_WINRT_COMPONENT
    /prop_tgt/VS_WINRT_EXTENSIONS
diff --git a/Help/prop_tgt/VS_USER_PROPS_CXX.rst 
b/Help/prop_tgt/VS_USER_PROPS.rst
similarity index 92%
rename from Help/prop_tgt/VS_USER_PROPS_CXX.rst
rename to Help/prop_tgt/VS_USER_PROPS.rst
index 083ce03..1be222b 100644
--- a/Help/prop_tgt/VS_USER_PROPS_CXX.rst
+++ b/Help/prop_tgt/VS_USER_PROPS.rst
@@ -1,5 +1,5 @@
-VS_USER_PROPS_CXX
------------------
+VS_USER_PROPS
+-------------
 
 Sets the user props file to be included in the visual studio
 C++ project file. The standard path is
diff --git a/Help/release/dev/vs-custom-msbuild-props.rst 
b/Help/release/dev/vs-custom-msbuild-props.rst
index 15a5b0a..68dae42 100644
--- a/Help/release/dev/vs-custom-msbuild-props.rst
+++ b/Help/release/dev/vs-custom-msbuild-props.rst
@@ -3,7 +3,7 @@ vs-custom-msbuild-props
 
 * The :ref:`Visual Studio Generators` for VS 2010 and above can
   now be fine tuned using custom msbuild .props files.
-  :prop_tgt:`VS_USER_PROPS_CXX` can be
+  :prop_tgt:`VS_USER_PROPS` can be
   used to change the default path of the user .props file from
   ``$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props`` to
   an arbitrary filename.
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx 
b/Source/cmVisualStudio10TargetGenerator.cxx
index 49274c0..dff6ad6 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -385,8 +385,7 @@ void cmVisualStudio10TargetGenerator::Generate()
   this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
   {
     std::string props = VS10_CXX_USER_PROPS;
-    if (const char* p =
-          this->GeneratorTarget->GetProperty("VS_USER_PROPS_CXX")) {
+    if (const char* p = this->GeneratorTarget->GetProperty("VS_USER_PROPS")) {
       props = p;
       this->ConvertToWindowsSlash(props);
     }
diff --git a/Tests/RunCMake/VS10Project/VsCustomProps.cmake 
b/Tests/RunCMake/VS10Project/VsCustomProps.cmake
index af52a3e..fbbcfcf 100644
--- a/Tests/RunCMake/VS10Project/VsCustomProps.cmake
+++ b/Tests/RunCMake/VS10Project/VsCustomProps.cmake
@@ -4,4 +4,4 @@ add_library(foo foo.cpp)
 set(props_file "${CMAKE_CURRENT_SOURCE_DIR}/my.props")
 
 set_target_properties(foo PROPERTIES
-    VS_USER_PROPS_CXX "${props_file}")
+    VS_USER_PROPS "${props_file}")

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

Summary of changes:
 Help/manual/cmake-properties.7.rst                 |    2 +-
 .../{VS_USER_PROPS_CXX.rst => VS_USER_PROPS.rst}   |    4 +-
 Help/release/dev/vs-csharp-support.rst             |   25 ++
 Help/release/dev/vs-custom-msbuild-props.rst       |    2 +-
 Modules/CMakeTestCSharpCompiler.cmake              |    4 -
 Source/cmVisualStudio10TargetGenerator.cxx         |  434 ++++++++++++++++----
 Source/cmVisualStudio10TargetGenerator.h           |    1 +
 Tests/CMakeLists.txt                               |    3 +
 Tests/CSharpOnly/CMakeLists.txt                    |   10 +
 Tests/CSharpOnly/csharponly.cs                     |   15 +
 Tests/CSharpOnly/lib1.cs                           |   10 +
 Tests/CSharpOnly/lib2.cs                           |   10 +
 Tests/RunCMake/VS10Project/VsCustomProps.cmake     |    2 +-
 13 files changed, 442 insertions(+), 80 deletions(-)
 rename Help/prop_tgt/{VS_USER_PROPS_CXX.rst => VS_USER_PROPS.rst} (92%)
 create mode 100644 Help/release/dev/vs-csharp-support.rst
 create mode 100644 Tests/CSharpOnly/CMakeLists.txt
 create mode 100644 Tests/CSharpOnly/csharponly.cs
 create mode 100644 Tests/CSharpOnly/lib1.cs
 create mode 100644 Tests/CSharpOnly/lib2.cs


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/mailman/listinfo/cmake-commits

Reply via email to