Merge branch 'FindHDF5-cleanup' into release-3.14

Merge-request: !2916
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
deleted file mode 100644
index e4cc01e..0000000
--- a/Help/release/dev/0-sample-topic.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-0-sample-topic
---------------
-
-* This is a sample release note for the change in a topic.
-  Developers should add similar notes for each topic branch
-  making a noteworthy change.  Each document should be named
-  and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 2318e03..4fcd4ca 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -7,8 +7,6 @@
   This file should include the adjacent "dev.txt" file
   in development versions but not in release versions.
 
-.. include:: dev.txt
-
 Releases
 ========
 
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 2f84c8e..83ce392 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -360,6 +360,15 @@
     else()
       set(id_sdkroot "")
     endif()
+    set(id_clang_cxx_library "")
+    set(stdlib_regex "(^| )(-stdlib=)([^ ]+)( |$)")
+    string(REGEX MATCHALL "${stdlib_regex}" all_stdlib_matches "${CMAKE_CXX_FLAGS}")
+    if(all_stdlib_matches)
+      list(GET all_stdlib_matches "-1" last_stdlib_match)
+      if(last_stdlib_match MATCHES "${stdlib_regex}")
+        set(id_clang_cxx_library "CLANG_CXX_LIBRARY = \"${CMAKE_MATCH_3}\";")
+      endif()
+    endif()
     configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-3.pbxproj.in
       ${id_dir}/CompilerId${lang}.xcodeproj/project.pbxproj @ONLY)
     unset(_ENV_MACOSX_DEPLOYMENT_TARGET)
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index 813c074..672044e 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -86,6 +86,7 @@
 				SYMROOT = .;
 				@id_toolset@
 				@id_lang_version@
+				@id_clang_cxx_library@
 				@id_deployment_target@
 				@id_sdkroot@
 			};
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 324d825..ffb88ef 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
-set(CMake_VERSION_MINOR 13)
-set(CMake_VERSION_PATCH 20190206)
-#set(CMake_VERSION_RC 1)
+set(CMake_VERSION_MINOR 14)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 1)
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 07656ed..d8b2e89 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -1136,6 +1136,8 @@
           value |= cmIDEFlagTable::CaseInsensitive;
         } else if (s == "SpaceAppendable") {
           value |= cmIDEFlagTable::SpaceAppendable;
+        } else if (s == "CommaAppendable") {
+          value |= cmIDEFlagTable::CommaAppendable;
         }
       }
     }
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 16f8a0e..51c001e 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -2254,6 +2254,22 @@
     debugStr = "NO";
   }
 
+  // extract C++ stdlib
+  for (auto const& language : languages) {
+    if (language != "CXX") {
+      continue;
+    }
+    std::string& flags = cflags[language];
+
+    auto stdlib =
+      this->ExtractFlagRegex("(^| )(-stdlib=[^ ]+)( |$)", 2, flags);
+    if (stdlib.size() > 8) {
+      const auto cxxLibrary = stdlib.substr(8);
+      buildSettings->AddAttribute("CLANG_CXX_LIBRARY",
+                                  this->CreateString(cxxLibrary));
+    }
+  }
+
   buildSettings->AddAttribute("COMBINE_HIDPI_IMAGES",
                               this->CreateString("YES"));
   buildSettings->AddAttribute("GCC_GENERATE_DEBUGGING_SYMBOLS",
diff --git a/Source/cmIDEFlagTable.h b/Source/cmIDEFlagTable.h
index 28d5d53..ff93432 100644
--- a/Source/cmIDEFlagTable.h
+++ b/Source/cmIDEFlagTable.h
@@ -29,6 +29,9 @@
     SpaceAppendable = (1 << 7),     // a flag that if specified multiple times
                                     // should have its value appended to the
                                     // old value with spaces
+    CommaAppendable = (1 << 8),     // a flag that if specified multiple times
+                                    // should have its value appended to the
+                                    // old value with commas (e.g. C# /nowarn
 
     UserValueIgnored = UserValue | UserIgnored,
     UserValueRequired = UserValue | UserRequired
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index ee0c782..ea67d45 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -148,6 +148,8 @@
     this->FlagMap[entry->IDEName].push_back(new_value);
   } else if (entry->special & cmIDEFlagTable::SpaceAppendable) {
     this->FlagMap[entry->IDEName].append_with_space(new_value);
+  } else if (entry->special & cmIDEFlagTable::CommaAppendable) {
+    this->FlagMap[entry->IDEName].append_with_comma(new_value);
   } else {
     // Use the user-specified value.
     this->FlagMap[entry->IDEName] = new_value;
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index a4e5757..4a43073 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -65,12 +65,22 @@
       this->derived::operator=(r);
       return *this;
     }
+    FlagValue& append_with_comma(std::string const& r)
+    {
+      return append_with_separator(r, ',');
+    }
     FlagValue& append_with_space(std::string const& r)
     {
+      return append_with_separator(r, ' ');
+    }
+
+  private:
+    FlagValue& append_with_separator(std::string const& r, char separator)
+    {
       this->resize(1);
       std::string& l = this->operator[](0);
       if (!l.empty()) {
-        l += " ";
+        l += separator;
       }
       l += r;
       return *this;
diff --git a/Templates/MSBuild/FlagTables/v10_CSharp.json b/Templates/MSBuild/FlagTables/v10_CSharp.json
index a0780a4..5989aea 100644
--- a/Templates/MSBuild/FlagTables/v10_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v10_CSharp.json
@@ -299,11 +299,15 @@
     "flags": []
   },
   {
-    "name":  "DisabledWarnings",
-    "switch": "nowarn",
+    "name":  "NoWarn",
+    "switch": "nowarn:",
     "comment": "",
     "value": "",
-    "flags": []
+    "flags": [
+      "UserValue",
+      "UserRequired",
+      "CommaAppendable"
+    ]
   },
   {
     "name":  "CheckForOverflowUnderflow",
diff --git a/Templates/MSBuild/FlagTables/v11_CSharp.json b/Templates/MSBuild/FlagTables/v11_CSharp.json
index a0780a4..5989aea 100644
--- a/Templates/MSBuild/FlagTables/v11_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v11_CSharp.json
@@ -299,11 +299,15 @@
     "flags": []
   },
   {
-    "name":  "DisabledWarnings",
-    "switch": "nowarn",
+    "name":  "NoWarn",
+    "switch": "nowarn:",
     "comment": "",
     "value": "",
-    "flags": []
+    "flags": [
+      "UserValue",
+      "UserRequired",
+      "CommaAppendable"
+    ]
   },
   {
     "name":  "CheckForOverflowUnderflow",
diff --git a/Templates/MSBuild/FlagTables/v12_CSharp.json b/Templates/MSBuild/FlagTables/v12_CSharp.json
index a0780a4..5989aea 100644
--- a/Templates/MSBuild/FlagTables/v12_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v12_CSharp.json
@@ -299,11 +299,15 @@
     "flags": []
   },
   {
-    "name":  "DisabledWarnings",
-    "switch": "nowarn",
+    "name":  "NoWarn",
+    "switch": "nowarn:",
     "comment": "",
     "value": "",
-    "flags": []
+    "flags": [
+      "UserValue",
+      "UserRequired",
+      "CommaAppendable"
+    ]
   },
   {
     "name":  "CheckForOverflowUnderflow",
diff --git a/Templates/MSBuild/FlagTables/v140_CSharp.json b/Templates/MSBuild/FlagTables/v140_CSharp.json
index a0780a4..5989aea 100644
--- a/Templates/MSBuild/FlagTables/v140_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v140_CSharp.json
@@ -299,11 +299,15 @@
     "flags": []
   },
   {
-    "name":  "DisabledWarnings",
-    "switch": "nowarn",
+    "name":  "NoWarn",
+    "switch": "nowarn:",
     "comment": "",
     "value": "",
-    "flags": []
+    "flags": [
+      "UserValue",
+      "UserRequired",
+      "CommaAppendable"
+    ]
   },
   {
     "name":  "CheckForOverflowUnderflow",
diff --git a/Templates/MSBuild/FlagTables/v141_CSharp.json b/Templates/MSBuild/FlagTables/v141_CSharp.json
index a0780a4..5989aea 100644
--- a/Templates/MSBuild/FlagTables/v141_CSharp.json
+++ b/Templates/MSBuild/FlagTables/v141_CSharp.json
@@ -299,11 +299,15 @@
     "flags": []
   },
   {
-    "name":  "DisabledWarnings",
-    "switch": "nowarn",
+    "name":  "NoWarn",
+    "switch": "nowarn:",
     "comment": "",
     "value": "",
-    "flags": []
+    "flags": [
+      "UserValue",
+      "UserRequired",
+      "CommaAppendable"
+    ]
   },
   {
     "name":  "CheckForOverflowUnderflow",
diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
index 7c1ed4e..df253a9 100644
--- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake
@@ -1,5 +1,6 @@
 include(RunCMake)
 
+run_cmake(VsCSharpCompilerOpts)
 run_cmake(ExplicitCMakeLists)
 run_cmake(SourceGroupCMakeLists)
 
diff --git a/Tests/RunCMake/VS10Project/VsCSharpCompilerOpts-check.cmake b/Tests/RunCMake/VS10Project/VsCSharpCompilerOpts-check.cmake
new file mode 100644
index 0000000..3e418c3
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpCompilerOpts-check.cmake
@@ -0,0 +1,64 @@
+#
+# Check C# VS project for required elements.
+#
+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(inDebug FALSE)
+set(inRelease FALSE)
+set(debugOK FALSE)
+set(releaseOK FALSE)
+
+
+file(STRINGS "${csProjectFile}" lines)
+foreach(line IN LISTS lines)
+  #message(STATUS ${line})
+  if(line MATCHES "^ *<PropertyGroup .*Debug\\|(Win32|x64).*")
+    set(inDebug TRUE)
+  elseif(line MATCHES "^ *<PropertyGroup .*Release\\|(Win32|x64).*")
+    set(inRelease TRUE)
+  elseif(line MATCHES "^ *</PropertyGroup> *$")
+    set(inRelease FALSE)
+    set(inDebug  FALSE)
+  elseif(inDebug AND
+    (line MATCHES "^ *<NoWarn>.*505.*</NoWarn> *$") AND
+    (line MATCHES "^ *<NoWarn>.*707.*</NoWarn> *$") AND
+    (line MATCHES "^ *<NoWarn>.*808.*</NoWarn> *$") AND
+    (line MATCHES "^ *<NoWarn>.*909.*</NoWarn> *$")
+    )
+    set(debugOK TRUE)
+  elseif(inRelease AND
+    (NOT (line MATCHES "^ *<NoWarn>.*505.*</NoWarn> *$")) AND
+    (line MATCHES "^ *<NoWarn>.*707.*</NoWarn> *$") AND
+    (line MATCHES "^ *<NoWarn>.*808.*</NoWarn> *$") AND
+    (line MATCHES "^ *<NoWarn>.*909.*</NoWarn> *$")
+    )
+    set(releaseOK TRUE)
+  endif()
+endforeach()
+
+function(print_csprojfile)
+  file(STRINGS "${csProjectFile}" lines)
+  foreach(line IN LISTS lines)
+    message(STATUS ${line})
+  endforeach()
+endfunction()
+
+
+if(NOT debugOK)
+  message(STATUS "Failed to set Debug configuration warning config correctly.")
+  set(RunCMake_TEST_FAILED "Failed to set Debug configuration defines correctly.")
+  print_csprojfile()
+  return()
+endif()
+
+if(NOT releaseOK)
+  message(STATUS "Failed to set Release configuration warning config correctly.")
+  set(RunCMake_TEST_FAILED "Failed to set Release configuration defines correctly.")
+  print_csprojfile()
+  return()
+endif()
diff --git a/Tests/RunCMake/VS10Project/VsCSharpCompilerOpts.cmake b/Tests/RunCMake/VS10Project/VsCSharpCompilerOpts.cmake
new file mode 100644
index 0000000..85af38b
--- /dev/null
+++ b/Tests/RunCMake/VS10Project/VsCSharpCompilerOpts.cmake
@@ -0,0 +1,14 @@
+enable_language(CSharp)
+
+add_library(foo SHARED
+  foo.cs)
+
+set_target_properties(foo PROPERTIES
+  LINKER_LANGUAGE CSharp)
+
+
+# Issue 18878
+target_compile_options(foo PRIVATE	"/platform:anycpu" "/nowarn:707,808" "/nowarn:909" )
+
+# Debug only warning disable
+set(CMAKE_CSharp_FLAGS_DEBUG "${CMAKE_CSharp_FLAGS_DEBUG} /nowarn:505")
diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake
index bbc7437..3613ae7 100644
--- a/Utilities/Release/upload_release.cmake
+++ b/Utilities/Release/upload_release.cmake
@@ -1,6 +1,6 @@
 set(CTEST_RUN_CURRENT_SCRIPT 0)
 if(NOT VERSION)
- set(VERSION 3.13)
+ set(VERSION 3.14)
 endif()
 if(NOT DEFINED PROJECT_PREFIX)
   set(PROJECT_PREFIX cmake-${VERSION})