Merge branch 'pch-makefile-depends' into release-3.16

Merge-request: !3928
diff --git a/Help/command/LINK_OPTIONS_LINKER.txt b/Help/command/LINK_OPTIONS_LINKER.txt
index a723375..3f66181 100644
--- a/Help/command/LINK_OPTIONS_LINKER.txt
+++ b/Help/command/LINK_OPTIONS_LINKER.txt
@@ -1,8 +1,8 @@
-To pass options to the linker tool, each compiler driver has is own syntax.
-The ``LINKER:`` prefix can be used to specify, in a portable way, options
-to pass to the linker tool. The ``LINKER:`` prefix is replaced by the required
-driver option and the rest of the option string defines linker arguments using
-``,`` as separator. These arguments will be formatted according to the
+To pass options to the linker tool, each compiler driver has its own syntax.
+The ``LINKER:`` prefix and ``,`` separator can be used to specify, in a portable
+way, options to pass to the linker tool. ``LINKER:`` is replaced by the
+appropriate driver option and ``,`` by the appropriate driver separator.
+The driver prefix and driver separator are given by the values of the
 :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG` and
 :variable:`CMAKE_<LANG>_LINKER_WRAPPER_FLAG_SEP` variables.
 
@@ -12,11 +12,11 @@
 The ``LINKER:`` prefix can be specified as part of a ``SHELL:`` prefix
 expression.
 
-The ``LINKER:`` prefix supports, as alternate syntax, specification of
-arguments using ``SHELL:`` prefix and space as separator. Previous example
-becomes ``"LINKER:SHELL:-z defs"``.
+The ``LINKER:`` prefix supports, as an alternative syntax, specification of
+arguments using the ``SHELL:`` prefix and space as separator. The previous
+example then becomes ``"LINKER:SHELL:-z defs"``.
 
 .. note::
 
-  Specifying ``SHELL:`` prefix elsewhere than at the beginning of the
+  Specifying the ``SHELL:`` prefix anywhere other than at the beginning of the
   ``LINKER:`` prefix is not supported.
diff --git a/Help/command/OPTIONS_SHELL.txt b/Help/command/OPTIONS_SHELL.txt
index 530c012..0f8ec32 100644
--- a/Help/command/OPTIONS_SHELL.txt
+++ b/Help/command/OPTIONS_SHELL.txt
@@ -1,9 +1,9 @@
 The final set of compile or link options used for a target is constructed by
 accumulating options from the current target and the usage requirements of
-it dependencies.  The set of options is de-duplicated to avoid repetition.
+its dependencies.  The set of options is de-duplicated to avoid repetition.
 While beneficial for individual options, the de-duplication step can break
 up option groups.  For example, ``-D A -D B`` becomes ``-D A B``.  One may
 specify a group of options using shell-like quoting along with a ``SHELL:``
-prefix.  The ``SHELL:`` prefix is dropped and the rest of the option string
+prefix.  The ``SHELL:`` prefix is dropped, and the rest of the option string
 is parsed using the :command:`separate_arguments` ``UNIX_COMMAND`` mode.
 For example, ``"SHELL:-D A" "SHELL:-D B"`` becomes ``-D A -D B``.
diff --git a/Help/command/target_precompile_headers.rst b/Help/command/target_precompile_headers.rst
index 3a32f41..d283948 100644
--- a/Help/command/target_precompile_headers.rst
+++ b/Help/command/target_precompile_headers.rst
@@ -47,6 +47,9 @@
 See the :manual:`cmake-generator-expressions(7)` manual for available
 expressions.  See the :manual:`cmake-compile-features(7)` manual for
 information on compile features and a list of supported compilers.
+The ``$<COMPILE_LANGUAGE:...>`` generator expression is particularly
+useful for specifying a language-specific header to precompile for
+only one language (e.g. ``CXX`` and not ``C``).
 
 Usage
 ^^^^^
@@ -56,6 +59,7 @@
   target_precompile_headers(<target>
     PUBLIC
       project_header.h
+      "$<$<COMPILE_LANGUAGE:CXX>:cxx_only.h>"
     PRIVATE
       [["other_header.h"]]
       <unordered_map>
diff --git a/Help/prop_tgt/UNITY_BUILD.rst b/Help/prop_tgt/UNITY_BUILD.rst
index beac5d4..2faad92 100644
--- a/Help/prop_tgt/UNITY_BUILD.rst
+++ b/Help/prop_tgt/UNITY_BUILD.rst
@@ -5,27 +5,33 @@
 faster compilation. This feature is known as "Unity build",
 or "Jumbo build".
 
-The `C` and `CXX` source files are grouped separately.
+The ``C`` and ``CXX`` source files are grouped separately.
 
 This property is initialized by the value of the
 :variable:`CMAKE_UNITY_BUILD` variable if it is set when
 a target is created.
 
-.. note ::
+.. note::
 
-   It's not recommended to directly set :prop_tgt:`UNITY_BUILD`
-   to `ON`, but to instead set :variable:`CMAKE_UNITY_BUILD` from
-   the command line. However, it IS recommended to set
-   :prop_tgt:`UNITY_BUILD` to `OFF` if you need to ensure that a
-   target doesn't get a unity build.
+  It's not recommended to directly set :prop_tgt:`UNITY_BUILD`
+  to ``ON``, but to instead set :variable:`CMAKE_UNITY_BUILD` from
+  the command line.  However, it IS recommended to set
+  :prop_tgt:`UNITY_BUILD` to ``OFF`` if you need to ensure that a
+  target doesn't get a unity build.
 
 The batch size can be specified by setting
 :prop_tgt:`UNITY_BUILD_BATCH_SIZE`.
 
 The batching of source files is done by adding new sources files
-wich will `#include` the source files, and exclude them from
-building by setting :prop_sf:`HEADER_FILE_ONLY` to `ON`.
+which will ``#include`` the source files, and exclude them from
+building by setting :prop_sf:`HEADER_FILE_ONLY` to ``ON``.
 
+.. note::
+
+  Marking the original sources with :prop_sf:`HEADER_FILE_ONLY`
+  is considered an implementation detail that may change in the
+  future because it does not work well in combination with
+  the :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable.
 
 ODR (One definition rule) errors
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,11 +51,11 @@
 With the :prop_tgt:`UNITY_BUILD_CODE_BEFORE_INCLUDE` and
 :prop_tgt:`UNITY_BUILD_CODE_AFTER_INCLUDE` one can specify code
 to be injected in the unity source file before and after every
-`#include` statement.
+``#include`` statement.
 
-.. note ::
+.. note::
 
-   The order of source files defined in the `CMakeLists.txt` will
-   be preserved into the generated unity source files. This can
-   be used to manually enforce a specific grouping based on the
-   :prop_tgt:`UNITY_BUILD_BATCH_SIZE`.
+  The order of source files defined in the ``CMakeLists.txt`` will
+  be preserved into the generated unity source files. This can
+  be used to manually enforce a specific grouping based on the
+  :prop_tgt:`UNITY_BUILD_BATCH_SIZE` target property.
diff --git a/Help/release/3.16.rst b/Help/release/3.16.rst
index a14effe..7992f2d 100644
--- a/Help/release/3.16.rst
+++ b/Help/release/3.16.rst
@@ -115,6 +115,10 @@
   specify the resource encoding for the the :generator:`Eclipse CDT4` extra
   generator.
 
+* The :variable:`CMAKE_UNITY_BUILD` variable was added to initialize the
+  :prop_tgt:`UNITY_BUILD` target property to tell generators to batch
+  include source files for faster compilation times.
+
 Properties
 ----------
 
diff --git a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst
index 8776279..4548abc 100644
--- a/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst
+++ b/Help/variable/CMAKE_EXPORT_COMPILE_COMMANDS.rst
@@ -28,3 +28,7 @@
 .. note::
   This option is implemented only by :ref:`Makefile Generators`
   and the :generator:`Ninja`.  It is ignored on other generators.
+
+  This option currently does not work well in combination with
+  the :prop_tgt:`UNITY_BUILD` target property or the
+  :variable:`CMAKE_UNITY_BUILD` variable.
diff --git a/Help/variable/CMAKE_STATIC_LINKER_FLAGS.rst b/Help/variable/CMAKE_STATIC_LINKER_FLAGS.rst
index 9c38673..1a810ce 100644
--- a/Help/variable/CMAKE_STATIC_LINKER_FLAGS.rst
+++ b/Help/variable/CMAKE_STATIC_LINKER_FLAGS.rst
@@ -1,6 +1,12 @@
 CMAKE_STATIC_LINKER_FLAGS
 -------------------------
 
-Linker flags to be used to create static libraries.
+Flags to be used to create static libraries.  These flags will be passed
+to the archiver when creating a static library.
 
-These flags will be used by the linker when creating a static library.
+See also :variable:`CMAKE_STATIC_LINKER_FLAGS_<CONFIG>`.
+
+.. note::
+  Static libraries do not actually link.  They are essentially archives
+  of object files.  The use of the name "linker" in the name of this
+  variable is kept for compatibility.
diff --git a/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst b/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst
index b9f8003..e561dc6 100644
--- a/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst
+++ b/Help/variable/CMAKE_STATIC_LINKER_FLAGS_CONFIG.rst
@@ -1,7 +1,13 @@
 CMAKE_STATIC_LINKER_FLAGS_<CONFIG>
 ----------------------------------
 
-Flags to be used when linking a static library.
+Flags to be used to create static libraries.  These flags will be passed
+to the archiver when creating a static library in the ``<CONFIG>``
+configuration.
 
-Same as ``CMAKE_C_FLAGS_*`` but used by the linker when creating static
-libraries.
+See also :variable:`CMAKE_STATIC_LINKER_FLAGS`.
+
+.. note::
+  Static libraries do not actually link.  They are essentially archives
+  of object files.  The use of the name "linker" in the name of this
+  variable is kept for compatibility.
diff --git a/Help/variable/CMAKE_UNITY_BUILD.rst b/Help/variable/CMAKE_UNITY_BUILD.rst
index 3096954..bbcfd68 100644
--- a/Help/variable/CMAKE_UNITY_BUILD.rst
+++ b/Help/variable/CMAKE_UNITY_BUILD.rst
@@ -1,6 +1,12 @@
 CMAKE_UNITY_BUILD
 -----------------
 
-Default value for :prop_tgt:`UNITY_BUILD` of targets.
+Initializes the :prop_tgt:`UNITY_BUILD` target property on targets
+as they are created.  Set to ``ON`` to batch compilation of multiple
+sources within each target.  This feature is known as "Unity build",
+or "Jumbo build".  By default this variable is not set and so does
+not enable unity builds on targets.
 
-By default ``CMAKE_UNITY_BUILD`` is ``OFF``.
+.. note::
+  This option currently does not work well in combination with
+  the :variable:`CMAKE_EXPORT_COMPILE_COMMANDS` variable.
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index ef65021..efb8abf 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -45,7 +45,7 @@
 set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
 set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
 
-foreach (lang OBJC OBJCXX)
+foreach (lang C OBJC OBJCXX)
   if (CMAKE_${lang}_COMPILER_ID_RUN)
     foreach(extension IN LISTS CMAKE_${lang}_SOURCE_FILE_EXTENSIONS)
       list(REMOVE_ITEM CMAKE_CXX_SOURCE_FILE_EXTENSIONS ${extension})
diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in
index 34639b4..a743ce7 100644
--- a/Modules/CMakeCXXCompilerId.cpp.in
+++ b/Modules/CMakeCXXCompilerId.cpp.in
@@ -27,10 +27,20 @@
 @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
 @CMAKE_CXX_COMPILER_ID_ERROR_FOR_TEST@
 
-#if defined(_MSC_VER) && defined(_MSVC_LANG)
-#define CXX_STD _MSVC_LANG
+#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
+#  if defined(__INTEL_CXX11_MODE__)
+#    if defined(__cpp_aggregate_nsdmi)
+#      define CXX_STD 201402L
+#    else
+#      define CXX_STD 201103L
+#    endif
+#  else
+#    define CXX_STD 199711L
+#  endif
+#elif defined(_MSC_VER) && defined(_MSVC_LANG)
+#  define CXX_STD _MSVC_LANG
 #else
-#define CXX_STD __cplusplus
+#  define CXX_STD __cplusplus
 #endif
 
 const char* info_language_dialect_default = "INFO" ":" "dialect_default["
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 3887b2d..69ace5a 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -167,18 +167,6 @@
                                        HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
   list(APPEND _CMAKE_TOOL_VARS AR RANLIB STRIP LINKER NM OBJDUMP OBJCOPY READELF DLLTOOL ADDR2LINE)
-
-
-  unset(_CMAKE_ADDITIONAL_AR_NAMES)
-  unset(_CMAKE_ADDITIONAL_RANLIB_NAMES)
-  unset(_CMAKE_ADDITIONAL_STRIP_NAMES)
-  unset(_CMAKE_ADDITIONAL_LINKER_NAMES)
-  unset(_CMAKE_ADDITIONAL_NM_NAMES)
-  unset(_CMAKE_ADDITIONAL_OBJDUMP_NAMES)
-  unset(_CMAKE_ADDITIONAL_OBJCOPY_NAMES)
-  unset(_CMAKE_ADDITIONAL_READELF_NAMES)
-  unset(_CMAKE_ADDITIONAL_DLLTOOL_NAMES)
-  unset(_CMAKE_ADDITIONAL_ADDR2LINE_NAMES)
 endif()
 
 if(CMAKE_PLATFORM_HAS_INSTALLNAME)
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in
index 95465ce..64a00b3 100644
--- a/Modules/CMakePlatformId.h.in
+++ b/Modules/CMakePlatformId.h.in
@@ -177,6 +177,9 @@
 # elif defined(__ICCV850__)
 #  define ARCHITECTURE_ID "V850"
 
+# elif defined(__ICC8051__)
+#  define ARCHITECTURE_ID "8051"
+
 # else /* unknown architecture */
 #  define ARCHITECTURE_ID ""
 # endif
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake
index 413d9e2..936d4ae 100644
--- a/Modules/Compiler/IAR-ASM.cmake
+++ b/Modules/Compiler/IAR-ASM.cmake
@@ -40,7 +40,12 @@
 elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850")
   set(CMAKE_ASM_COMPILE_OBJECT  "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
   __compiler_iar_xlink(ASM)
-  set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS r85;asm;msa)
+  set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s85;asm;msa)
+
+elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
+  set(CMAKE_ASM_COMPILE_OBJECT  "<CMAKE_ASM_COMPILER> -S <SOURCE> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT>")
+  __compiler_iar_xlink(ASM)
+  set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s51;asm;msa)
 
 else()
   message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake
index 9ad1ba0..e27fdfc 100644
--- a/Modules/Compiler/IAR-C.cmake
+++ b/Modules/Compiler/IAR-C.cmake
@@ -65,6 +65,11 @@
   __compiler_check_default_language_standard(C 1.10 90 4.10 99)
   set(CMAKE_C_OUTPUT_EXTENSION ".r85")
 
+elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
+  __compiler_iar_xlink(C)
+  __compiler_check_default_language_standard(C 6.10 90 8.10 99)
+  set(CMAKE_C_OUTPUT_EXTENSION ".r51")
+
 else()
   message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected. This should be automatic.")
 endif()
diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake
index 549d242..eca89c5 100644
--- a/Modules/Compiler/IAR-CXX.cmake
+++ b/Modules/Compiler/IAR-CXX.cmake
@@ -72,6 +72,12 @@
   __compiler_iar_xlink(CXX)
   __compiler_check_default_language_standard(CXX 1.10 98)
   set(CMAKE_C_OUTPUT_EXTENSION ".r85")
+
+elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
+  __compiler_iar_xlink(CXX)
+  __compiler_check_default_language_standard(CXX 6.10 98)
+  set(CMAKE_C_OUTPUT_EXTENSION ".r51")
+
 else()
   message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected. This should be automatic." )
 endif()
diff --git a/Modules/Compiler/IAR-DetermineCompiler.cmake b/Modules/Compiler/IAR-DetermineCompiler.cmake
index 7e17778..0a026b2 100644
--- a/Modules/Compiler/IAR-DetermineCompiler.cmake
+++ b/Modules/Compiler/IAR-DetermineCompiler.cmake
@@ -31,7 +31,7 @@
 #  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(((__VER__) / 1000) % 1000)
 #  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@((__VER__) % 1000)
 #  define @PREFIX@COMPILER_VERSION_INTERNAL @MACRO_DEC@(__IAR_SYSTEMS_ICC__)
-# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__))
+# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__))
 #  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__VER__) / 100)
 #  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__VER__) - (((__VER__) / 100)*100))
 #  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__SUBVERSION__)
diff --git a/Modules/Compiler/IAR-FindBinUtils.cmake b/Modules/Compiler/IAR-FindBinUtils.cmake
index 6258cf3..6ef3759 100644
--- a/Modules/Compiler/IAR-FindBinUtils.cmake
+++ b/Modules/Compiler/IAR-FindBinUtils.cmake
@@ -46,7 +46,8 @@
 
 elseif("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR" OR
        "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "MSP430" OR
-       "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850")
+       "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "V850" OR
+       "${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_ARCHITECTURE_ID}" STREQUAL "8051")
 
   # Find the "xlink" linker and "xar" archiver:
   find_program(CMAKE_IAR_LINKER xlink HINTS ${__iar_hints}
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 5abc08a..ad40522 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -134,11 +134,13 @@
   endif()
 
   if (CURSES_NEED_WIDE)
+    set(CURSES_TINFO_LIBRARY_NAME tinfow)
     find_path(CURSES_INCLUDE_PATH
       NAMES ncursesw/ncurses.h ncursesw/curses.h ncursesw.h cursesw.h
       HINTS "${_cursesParentDir}/include"
       )
   else()
+    set(CURSES_TINFO_LIBRARY_NAME tinfo)
     find_path(CURSES_INCLUDE_PATH
       NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
       HINTS "${_cursesParentDir}/include"
@@ -153,8 +155,8 @@
   CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
     cbreak "" CURSES_NCURSES_HAS_CBREAK)
   if(NOT CURSES_NCURSES_HAS_CBREAK)
-    find_library(CURSES_EXTRA_LIBRARY tinfo HINTS "${_cursesLibDir}")
-    find_library(CURSES_EXTRA_LIBRARY tinfo )
+    find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" HINTS "${_cursesLibDir}")
+    find_library(CURSES_EXTRA_LIBRARY "${CURSES_TINFO_LIBRARY_NAME}" )
   endif()
 else()
   get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
diff --git a/Modules/FindHDF5.cmake b/Modules/FindHDF5.cmake
index 08863c8..b488418 100644
--- a/Modules/FindHDF5.cmake
+++ b/Modules/FindHDF5.cmake
@@ -761,7 +761,7 @@
 if( NOT HDF5_FOUND )
     # seed the initial lists of libraries to find with items we know we need
     set(HDF5_C_LIBRARY_NAMES          hdf5)
-    set(HDF5_C_HL_LIBRARY_NAMES       hdf5_hl)
+    set(HDF5_C_HL_LIBRARY_NAMES       hdf5_hl ${HDF5_C_LIBRARY_NAMES} )
 
     set(HDF5_CXX_LIBRARY_NAMES        hdf5_cpp    ${HDF5_C_LIBRARY_NAMES})
     set(HDF5_CXX_HL_LIBRARY_NAMES     hdf5_hl_cpp ${HDF5_C_HL_LIBRARY_NAMES} ${HDF5_CXX_LIBRARY_NAMES})
@@ -772,7 +772,7 @@
     foreach(__lang IN LISTS HDF5_LANGUAGE_BINDINGS)
         # find the HDF5 include directories
         if("${__lang}" STREQUAL "Fortran")
-            set(HDF5_INCLUDE_FILENAME hdf5.mod)
+            set(HDF5_INCLUDE_FILENAME hdf5.mod HDF5.mod)
         elseif("${__lang}" STREQUAL "CXX")
             set(HDF5_INCLUDE_FILENAME H5Cpp.h)
         else()
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index def23bb..ab9d73a 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -128,6 +128,8 @@
 #ifdef _OPENMP
   omp_get_max_threads();
   return 0;
+#elif defined(__HIP_DEVICE_COMPILE__)
+  return 0;
 #else
   breaks_on_purpose
 #endif
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index dfece22..cfa4ebc 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -87,7 +87,7 @@
 
 
 set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
-    "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+    "12" "11" "10" "9.6" "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
 
 # Define additional search paths for root directories.
 set( PostgreSQL_ROOT_DIRECTORIES
@@ -107,8 +107,11 @@
     list(APPEND PostgreSQL_LIBRARY_ADDITIONAL_SEARCH_SUFFIXES
         "pgsql-${suffix}/lib")
     list(APPEND PostgreSQL_INCLUDE_ADDITIONAL_SEARCH_SUFFIXES
+        "postgresql${suffix}"
+        "postgresql/${suffix}"
         "pgsql-${suffix}/include")
     list(APPEND PostgreSQL_TYPE_ADDITIONAL_SEARCH_SUFFIXES
+        "postgresql${suffix}/server"
         "postgresql/${suffix}/server"
         "pgsql-${suffix}/include/server")
   endif()
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index e3eeea4..0e1429d 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -258,6 +258,7 @@
         cmake_host_system_information(RESULT _vs_dir QUERY VS_${_vs_ver}_DIR) # undocumented query
         if(IS_DIRECTORY "${_vs_dir}")
           file(GLOB _vs_glob_redist_paths "${_vs_dir}/VC/Redist/MSVC/*")
+          list(REVERSE _vs_glob_redist_paths)
           list(APPEND _vs_redist_paths ${_vs_glob_redist_paths})
         endif()
         unset(_vs_glob_redist_paths)
@@ -287,6 +288,9 @@
         "${MSVC_CRT_DIR}/msvcp${v}.dll"
         )
       if(NOT vs VERSION_LESS 14)
+        if(EXISTS "${MSVC_CRT_DIR}/vcruntime${v}_1.dll")
+          list(APPEND __install__libs "${MSVC_CRT_DIR}/vcruntime${v}_1.dll")
+        endif()
         list(APPEND __install__libs
             "${MSVC_CRT_DIR}/vcruntime${v}.dll"
             "${MSVC_CRT_DIR}/concrt${v}.dll"
@@ -305,6 +309,9 @@
         "${MSVC_CRT_DIR}/msvcp${v}d.dll"
         )
       if(NOT vs VERSION_LESS 14)
+        if(EXISTS "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll")
+          list(APPEND __install__libs "${MSVC_CRT_DIR}/vcruntime${v}_1d.dll")
+        endif()
         list(APPEND __install__libs
             "${MSVC_CRT_DIR}/vcruntime${v}d.dll"
             "${MSVC_CRT_DIR}/concrt${v}d.dll"
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0f2a2d2..9e785da 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -19,55 +19,57 @@
   set(CMake_VERSION_IS_RELEASE 0)
 endif()
 
-if(EXISTS ${CMake_SOURCE_DIR}/.git)
-  find_package(Git QUIET)
-  if(GIT_FOUND)
-    macro(_git)
-      execute_process(
-        COMMAND ${GIT_EXECUTABLE} ${ARGN}
-        WORKING_DIRECTORY ${CMake_SOURCE_DIR}
-        RESULT_VARIABLE _git_res
-        OUTPUT_VARIABLE _git_out OUTPUT_STRIP_TRAILING_WHITESPACE
-        ERROR_VARIABLE _git_err ERROR_STRIP_TRAILING_WHITESPACE
-        )
-    endmacro()
-  endif()
-endif()
-
-# Try to identify the current development source version.
-if(COMMAND _git)
-  # Get the commit checked out in this work tree.
-  _git(log -n 1 HEAD "--pretty=format:%h %s" --)
-  set(git_info "${_git_out}")
-else()
-  # Get the commit exported by 'git archive'.
+if(NOT CMake_VERSION_NO_GIT)
+  # If this source was exported by 'git archive', use its commit info.
   set(git_info [==[$Format:%h %s$]==])
-endif()
 
-# Extract commit information if available.
-if(git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* (.*)$")
-  # Have commit information.
-  set(git_hash "${CMAKE_MATCH_1}")
-  set(git_subject "${CMAKE_MATCH_2}")
-
-  # If this is not the exact commit of a release, add dev info.
-  if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$")
-    set(CMake_VERSION "${CMake_VERSION}-g${git_hash}")
-  endif()
-
-  # If this is a work tree, check whether it is dirty.
-  if(COMMAND _git)
-    _git(update-index -q --refresh)
-    _git(diff-index --name-only HEAD --)
-    if(_git_out)
-      set(CMake_VERSION_IS_DIRTY 1)
+  # Otherwise, try to identify the current development source version.
+  if(NOT git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* "
+      AND EXISTS ${CMake_SOURCE_DIR}/.git)
+    find_package(Git QUIET)
+    if(GIT_FOUND)
+      macro(_git)
+        execute_process(
+          COMMAND ${GIT_EXECUTABLE} ${ARGN}
+          WORKING_DIRECTORY ${CMake_SOURCE_DIR}
+          RESULT_VARIABLE _git_res
+          OUTPUT_VARIABLE _git_out OUTPUT_STRIP_TRAILING_WHITESPACE
+          ERROR_VARIABLE _git_err ERROR_STRIP_TRAILING_WHITESPACE
+          )
+      endmacro()
+    endif()
+    if(COMMAND _git)
+      # Get the commit checked out in this work tree.
+      _git(log -n 1 HEAD "--pretty=format:%h %s" --)
+      set(git_info "${_git_out}")
     endif()
   endif()
-else()
-  # No commit information.
-  if(NOT CMake_VERSION_IS_RELEASE)
-    # Generic development version.
-    set(CMake_VERSION "${CMake_VERSION}-git")
+
+  # Extract commit information if available.
+  if(git_info MATCHES "^([0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]?[0-9a-f]?)[0-9a-f]* (.*)$")
+    # Have commit information.
+    set(git_hash "${CMAKE_MATCH_1}")
+    set(git_subject "${CMAKE_MATCH_2}")
+
+    # If this is not the exact commit of a release, add dev info.
+    if(NOT "${git_subject}" MATCHES "^[Cc][Mm]ake ${CMake_VERSION}$")
+      set(CMake_VERSION "${CMake_VERSION}-g${git_hash}")
+    endif()
+
+    # If this is a work tree, check whether it is dirty.
+    if(COMMAND _git)
+      _git(update-index -q --refresh)
+      _git(diff-index --name-only HEAD --)
+      if(_git_out)
+        set(CMake_VERSION_IS_DIRTY 1)
+      endif()
+    endif()
+  else()
+    # No commit information.
+    if(NOT CMake_VERSION_IS_RELEASE)
+      # Generic development version.
+      set(CMake_VERSION "${CMake_VERSION}-git")
+    endif()
   endif()
 endif()
 
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 515f446..910cc9d 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -56,6 +56,8 @@
 static std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT";
 static std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE";
 static std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK";
+static std::string const kCMAKE_Swift_COMPILER_TARGET =
+  "CMAKE_Swift_COMPILER_TARGET";
 static std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES =
   "CMAKE_TRY_COMPILE_OSX_ARCHITECTURES";
 static std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
@@ -671,6 +673,7 @@
       vars.insert(kCMAKE_SYSROOT);
       vars.insert(kCMAKE_SYSROOT_COMPILE);
       vars.insert(kCMAKE_SYSROOT_LINK);
+      vars.insert(kCMAKE_Swift_COMPILER_TARGET);
       vars.insert(kCMAKE_WARN_DEPRECATED);
       vars.emplace("CMAKE_MSVC_RUNTIME_LIBRARY"_s);
 
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 3d7eccc..aeef602 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -752,9 +752,9 @@
 
   if (iface->ImplementationIsInterface) {
     // Policy CMP0022 must not be NEW.
-    this->SetImportLinkProperty(suffix, target,
-                                "IMPORTED_LINK_INTERFACE_LIBRARIES",
-                                iface->Libraries, properties, missingTargets);
+    this->SetImportLinkProperty(
+      suffix, target, "IMPORTED_LINK_INTERFACE_LIBRARIES", iface->Libraries,
+      properties, missingTargets, ImportLinkPropertyTargetNames::Yes);
     return;
   }
 
@@ -832,14 +832,14 @@
   // Add the transitive link dependencies for this configuration.
   if (cmLinkInterface const* iface =
         target->GetLinkInterface(config, target)) {
-    this->SetImportLinkProperty(suffix, target,
-                                "IMPORTED_LINK_INTERFACE_LANGUAGES",
-                                iface->Languages, properties, missingTargets);
+    this->SetImportLinkProperty(
+      suffix, target, "IMPORTED_LINK_INTERFACE_LANGUAGES", iface->Languages,
+      properties, missingTargets, ImportLinkPropertyTargetNames::No);
 
     std::vector<std::string> dummy;
-    this->SetImportLinkProperty(suffix, target,
-                                "IMPORTED_LINK_DEPENDENT_LIBRARIES",
-                                iface->SharedDeps, properties, dummy);
+    this->SetImportLinkProperty(
+      suffix, target, "IMPORTED_LINK_DEPENDENT_LIBRARIES", iface->SharedDeps,
+      properties, dummy, ImportLinkPropertyTargetNames::Yes);
     if (iface->Multiplicity > 0) {
       std::string prop =
         cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix);
@@ -880,7 +880,8 @@
 void cmExportFileGenerator::SetImportLinkProperty(
   std::string const& suffix, cmGeneratorTarget* target,
   const std::string& propName, std::vector<T> const& entries,
-  ImportPropertyMap& properties, std::vector<std::string>& missingTargets)
+  ImportPropertyMap& properties, std::vector<std::string>& missingTargets,
+  ImportLinkPropertyTargetNames targetNames)
 {
   // Skip the property if there are no entries.
   if (entries.empty()) {
@@ -895,9 +896,13 @@
     link_entries += sep;
     sep = ";";
 
-    std::string temp = asString(l);
-    this->AddTargetNamespace(temp, target, missingTargets);
-    link_entries += temp;
+    if (targetNames == ImportLinkPropertyTargetNames::Yes) {
+      std::string temp = asString(l);
+      this->AddTargetNamespace(temp, target, missingTargets);
+      link_entries += temp;
+    } else {
+      link_entries += asString(l);
+    }
   }
 
   // Store the property.
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index b04a31e..0d69779 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -102,13 +102,19 @@
                                  ImportPropertyMap& properties,
                                  std::vector<std::string>& missingTargets);
 
+  enum class ImportLinkPropertyTargetNames
+  {
+    Yes,
+    No,
+  };
   template <typename T>
   void SetImportLinkProperty(std::string const& suffix,
                              cmGeneratorTarget* target,
                              const std::string& propName,
                              std::vector<T> const& entries,
                              ImportPropertyMap& properties,
-                             std::vector<std::string>& missingTargets);
+                             std::vector<std::string>& missingTargets,
+                             ImportLinkPropertyTargetNames targetNames);
 
   /** Each subclass knows how to generate its kind of export file.  */
   virtual bool GenerateMainFile(std::ostream& os) = 0;
diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx
index a490e03..7fc33e6 100644
--- a/Source/cmVisualStudio10ToolsetOptions.cxx
+++ b/Source/cmVisualStudio10ToolsetOptions.cxx
@@ -34,8 +34,7 @@
   std::string const useToolset = this->GetToolsetName(name, toolset);
 
   if (useToolset == "v142") {
-    // FIXME: Add CSharp flag table for v142.
-    return "v141";
+    return "v142";
   } else if (useToolset == "v141") {
     return "v141";
   } else if (useToolset == "v140") {
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 50f47af..f63a264 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -423,6 +423,8 @@
         }
       }
       std::cout << "loading initial cache file " << path << "\n";
+      // Resolve script path specified on command line relative to $PWD.
+      path = cmSystemTools::CollapseFullPath(path);
       this->ReadListFile(args, path);
     } else if (arg.find("-P", 0) == 0) {
       i++;
diff --git a/Templates/MSBuild/FlagTables/v142_CSharp.json b/Templates/MSBuild/FlagTables/v142_CSharp.json
new file mode 100644
index 0000000..5989aea
--- /dev/null
+++ b/Templates/MSBuild/FlagTables/v142_CSharp.json
@@ -0,0 +1,574 @@
+[
+  {
+    "name":  "ProjectName",
+    "switch": "out:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "UserValue",
+      "UserRequired"
+    ]
+  },
+  {
+    "name":  "OutputType",
+    "switch": "target:exe",
+    "comment": "",
+    "value": "Exe",
+    "flags": []
+  },
+  {
+    "name":  "OutputType",
+    "switch": "target:winexe",
+    "comment": "",
+    "value": "Winexe",
+    "flags": []
+  },
+  {
+    "name":  "OutputType",
+    "switch": "target:library",
+    "comment": "",
+    "value": "Library",
+    "flags": []
+  },
+  {
+    "name":  "OutputType",
+    "switch": "target:module",
+    "comment": "",
+    "value": "Module",
+    "flags": []
+  },
+  {
+    "name":  "DocumentationFile",
+    "switch": "doc",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "UserValue",
+      "UserRequired"
+    ]
+  },
+  {
+    "name":  "Platform",
+    "switch": "platform:x86",
+    "comment": "",
+    "value": "x86",
+    "flags": []
+  },
+  {
+    "name":  "Platform",
+    "switch": "platform:Itanium",
+    "comment": "",
+    "value": "Itanium",
+    "flags": []
+  },
+  {
+    "name":  "Platform",
+    "switch": "platform:x64",
+    "comment": "",
+    "value": "x64",
+    "flags": []
+  },
+  {
+    "name":  "Platform",
+    "switch": "platform:arm",
+    "comment": "",
+    "value": "arm",
+    "flags": []
+  },
+  {
+    "name":  "Platform",
+    "switch": "platform:anycpu32bitpreferred",
+    "comment": "",
+    "value": "anycpu32bitpreferred",
+    "flags": []
+  },
+  {
+    "name":  "Platform",
+    "switch": "platform:anycpu",
+    "comment": "",
+    "value": "anycpu",
+    "flags": []
+  },
+  {
+    "name":  "References",
+    "switch": "reference:",
+    "comment": "mit alias",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "References",
+    "switch": "reference:",
+    "comment": "dateiliste",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "AddModules",
+    "switch": "addmodule:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "SemicolonAppendable"
+    ]
+  },
+  {
+    "name":  "Win32Resource",
+    "switch": "win32res:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "UserValue",
+      "UserRequired"
+    ]
+  },
+  {
+    "name":  "ApplicationIcon",
+    "switch": "win32icon:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "UserValue",
+      "UserRequired"
+    ]
+  },
+  {
+    "name":  "ApplicationManifest",
+    "switch": "win32manifest:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "UserValue",
+      "UserRequired"
+    ]
+  },
+  {
+    "name":  "NoWin32Manifest",
+    "switch": "nowin32manifest",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "DefineDebug",
+    "switch": "debug",
+    "comment": "",
+    "value": "true",
+    "flags": [
+      "Continue"
+    ]
+  },
+  {
+    "name":  "DebugSymbols",
+    "switch": "debug",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "DebugSymbols",
+    "switch": "debug-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "DebugSymbols",
+    "switch": "debug+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "DebugType",
+    "switch": "debug:none",
+    "comment": "",
+    "value": "none",
+    "flags": []
+  },
+  {
+    "name":  "DebugType",
+    "switch": "debug:full",
+    "comment": "",
+    "value": "full",
+    "flags": []
+  },
+  {
+    "name":  "DebugType",
+    "switch": "debug:pdbonly",
+    "comment": "",
+    "value": "pdbonly",
+    "flags": []
+  },
+  {
+    "name":  "Optimize",
+    "switch": "optimize",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "Optimize",
+    "switch": "optimize-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "Optimize",
+    "switch": "optimize+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "TreatWarningsAsErrors",
+    "switch": "warnaserror",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "TreatWarningsAsErrors",
+    "switch": "warnaserror-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "TreatWarningsAsErrors",
+    "switch": "warnaserror+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "WarningsAsErrors",
+    "switch": "warnaserror",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "WarningsAsErrors",
+    "switch": "warnaserror-",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "WarningsAsErrors",
+    "switch": "warnaserror+",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "WarningLevel",
+    "switch": "warn:0",
+    "comment": "",
+    "value": "0",
+    "flags": []
+  },
+  {
+    "name":  "WarningLevel",
+    "switch": "warn:1",
+    "comment": "",
+    "value": "1",
+    "flags": []
+  },
+  {
+    "name":  "WarningLevel",
+    "switch": "warn:2",
+    "comment": "",
+    "value": "2",
+    "flags": []
+  },
+  {
+    "name":  "WarningLevel",
+    "switch": "warn:3",
+    "comment": "",
+    "value": "3",
+    "flags": []
+  },
+  {
+    "name":  "WarningLevel",
+    "switch": "warn:4",
+    "comment": "",
+    "value": "4",
+    "flags": []
+  },
+  {
+    "name":  "NoWarn",
+    "switch": "nowarn:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "UserValue",
+      "UserRequired",
+      "CommaAppendable"
+    ]
+  },
+  {
+    "name":  "CheckForOverflowUnderflow",
+    "switch": "checked",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "CheckForOverflowUnderflow",
+    "switch": "checked-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "CheckForOverflowUnderflow",
+    "switch": "checked+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "AllowUnsafeBlocks",
+    "switch": "unsafe",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "AllowUnsafeBlocks",
+    "switch": "unsafe-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "AllowUnsafeBlocks",
+    "switch": "unsafe+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "DefineConstants",
+    "switch": "define:",
+    "comment": "",
+    "value": "",
+    "flags": [
+      "SemicolonAppendable",
+      "UserValue"
+    ]
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:ISO-1",
+    "comment": "",
+    "value": "ISO-1",
+    "flags": []
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:ISO-2",
+    "comment": "",
+    "value": "ISO-2",
+    "flags": []
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:3",
+    "comment": "",
+    "value": "3",
+    "flags": []
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:4",
+    "comment": "",
+    "value": "4",
+    "flags": []
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:5",
+    "comment": "",
+    "value": "5",
+    "flags": []
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:6",
+    "comment": "",
+    "value": "6",
+    "flags": []
+  },
+  {
+    "name":  "LangVersion",
+    "switch": "langversion:default",
+    "comment": "",
+    "value": "default",
+    "flags": []
+  },
+  {
+    "name":  "DelaySign",
+    "switch": "delaysign",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "DelaySign",
+    "switch": "delaysign-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "DelaySign",
+    "switch": "delaysign+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "AssemblyOriginatorKeyFile",
+    "switch": "keyfile",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "KeyContainerName",
+    "switch": "keycontainer",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "NoLogo",
+    "switch": "nologo",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "NoConfig",
+    "switch": "noconfig",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "BaseAddress",
+    "switch": "baseaddress:",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "CodePage",
+    "switch": "codepage",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "Utf8Output",
+    "switch": "utf8output",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "MainEntryPoint",
+    "switch": "main:",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "GenerateFullPaths",
+    "switch": "fullpaths",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "FileAlignment",
+    "switch": "filealign",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "PdbFile",
+    "switch": "pdb:",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "NoStandardLib",
+    "switch": "nostdlib",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "NoStandardLib",
+    "switch": "nostdlib-",
+    "comment": "",
+    "value": "false",
+    "flags": []
+  },
+  {
+    "name":  "NoStandardLib",
+    "switch": "nostdlib+",
+    "comment": "",
+    "value": "true",
+    "flags": []
+  },
+  {
+    "name":  "SubsystemVersion",
+    "switch": "subsystemversion",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "AdditionalLibPaths",
+    "switch": "lib:",
+    "comment": "",
+    "value": "",
+    "flags": []
+  },
+  {
+    "name":  "ErrorReport",
+    "switch": "errorreport:none",
+    "comment": "Do Not Send Report",
+    "value": "none",
+    "flags": []
+  },
+  {
+    "name":  "ErrorReport",
+    "switch": "errorreport:prompt",
+    "comment": "Prompt Immediately",
+    "value": "prompt",
+    "flags": []
+  },
+  {
+    "name":  "ErrorReport",
+    "switch": "errorreport:queue",
+    "comment": "Queue For Next Login",
+    "value": "queue",
+    "flags": []
+  },
+  {
+    "name":  "ErrorReport",
+    "switch": "errorreport:send",
+    "comment": "Send Automatically",
+    "value": "send",
+    "flags": []
+  }
+]
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 32b580b..b29638b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2353,6 +2353,18 @@
       )
       list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/c-file-extension-test")
 
+      add_test(Objective-C.cxx-file-extension-test ${CMAKE_CTEST_COMMAND}
+        --build-and-test
+        "${CMake_SOURCE_DIR}/Tests/Objective-C/cxx-file-extension-test"
+        "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test"
+        --build-two-config
+        ${build_generator_args}
+        --build-project cxx-file-extension-test
+        --build-options ${build_options}
+        --test-command cxx-file-extension-test
+      )
+      list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/Objective-C/cxx-file-extension-test")
+
       add_test(Objective-C.objc-file-extension-test ${CMAKE_CTEST_COMMAND}
         --build-and-test
         "${CMake_SOURCE_DIR}/Tests/Objective-C/objc-file-extension-test"
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt
index 060fb49..ef9198d 100644
--- a/Tests/CompileFeatures/CMakeLists.txt
+++ b/Tests/CompileFeatures/CMakeLists.txt
@@ -130,6 +130,12 @@
 endif()
 
 if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
+  if (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"
+      AND CMAKE_CXX_SIMULATE_VERSION VERSION_LESS 19.10)
+    list(REMOVE_ITEM CXX_non_features
+      cxx_relaxed_constexpr
+      )
+  endif()
   if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
     if (CMAKE_CXX_COMIPLER_VERSION VERSION_EQUAL 15.0)
       list(REMOVE_ITEM CXX_non_features
diff --git a/Tests/CompileFeatures/default_dialect.cpp b/Tests/CompileFeatures/default_dialect.cpp
index 3ee60a6..e6b3ff6 100644
--- a/Tests/CompileFeatures/default_dialect.cpp
+++ b/Tests/CompileFeatures/default_dialect.cpp
@@ -2,7 +2,17 @@
 template <long l>
 struct Outputter;
 
-#if defined(_MSC_VER) && defined(_MSVC_LANG)
+#if defined(__INTEL_COMPILER) && defined(_MSVC_LANG) && _MSVC_LANG < 201403L
+#  if defined(__INTEL_CXX11_MODE__)
+#    if defined(__cpp_aggregate_nsdmi)
+#      define CXX_STD 201402L
+#    else
+#      define CXX_STD 201103L
+#    endif
+#  else
+#    define CXX_STD 199711L
+#  endif
+#elif defined(_MSC_VER) && defined(_MSVC_LANG)
 #  define CXX_STD _MSVC_LANG
 #else
 #  define CXX_STD __cplusplus
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index 5cf04e8..9d8a248 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -645,3 +645,8 @@
     EXPORT RequiredExp DESTINATION lib)
   export(TARGETS testLinkDepends NAMESPACE bld_ APPEND FILE ExportBuildTree.cmake)
 endif()
+
+# Test the presence of targets named the same as languages.
+# IMPORTED_LINK_INTERFACE_LANGUAGES entries should not be targets.
+add_library(C INTERFACE)
+add_library(CXX INTERFACE)
diff --git a/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt b/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt
new file mode 100644
index 0000000..eb065e4
--- /dev/null
+++ b/Tests/Objective-C/cxx-file-extension-test/CMakeLists.txt
@@ -0,0 +1,8 @@
+cmake_minimum_required(VERSION 3.15)
+
+project(cxx-file-extension-test)
+
+string(APPEND CMAKE_CXX_FLAGS " -std=c++11")
+set(CMAKE_CXX_STANDARD 14)
+
+add_executable(cxx-file-extension-test main.m)
diff --git a/Tests/Objective-C/cxx-file-extension-test/main.m b/Tests/Objective-C/cxx-file-extension-test/main.m
new file mode 100644
index 0000000..1c159a9
--- /dev/null
+++ b/Tests/Objective-C/cxx-file-extension-test/main.m
@@ -0,0 +1,8 @@
+#ifndef __OBJC__
+#  error "Compiler cannot compile Objective-C"
+#endif
+
+int main()
+{
+  return 0;
+}
diff --git a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt
index 2a4ee64..b65a349 100644
--- a/Tests/RunCMake/CommandLine/C-no-file-stderr.txt
+++ b/Tests/RunCMake/CommandLine/C-no-file-stderr.txt
@@ -1,3 +1,3 @@
-^CMake Error: Error processing file: nosuchcachefile.txt
+^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine/C-no-file-build/nosuchcachefile.txt
 CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/C-no-file-build" does not appear to contain CMakeLists.txt.
 Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/C_basic-stderr.txt b/Tests/RunCMake/CommandLine/C_basic-stderr.txt
new file mode 100644
index 0000000..62d0cd5
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic-stderr.txt
@@ -0,0 +1,4 @@
+initial-cache.txt: CMAKE_SOURCE_DIR: .*/Tests/RunCMake/CommandLine
+initial-cache.txt: CMAKE_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic-build
+CMakeLists.txt: INITIAL_SOURCE_DIR: .*/Tests/RunCMake/CommandLine
+CMakeLists.txt: INITIAL_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic-build
diff --git a/Tests/RunCMake/CommandLine/C_basic-stdout.txt b/Tests/RunCMake/CommandLine/C_basic-stdout.txt
new file mode 100644
index 0000000..74a938e
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic-stdout.txt
@@ -0,0 +1 @@
+loading initial cache file ../C_basic_initial-cache.txt
diff --git a/Tests/RunCMake/CommandLine/C_basic.cmake b/Tests/RunCMake/CommandLine/C_basic.cmake
new file mode 100644
index 0000000..1a56593
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic.cmake
@@ -0,0 +1,2 @@
+message("CMakeLists.txt: INITIAL_SOURCE_DIR: ${INITIAL_SOURCE_DIR}")
+message("CMakeLists.txt: INITIAL_BINARY_DIR: ${INITIAL_BINARY_DIR}")
diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt b/Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt
new file mode 100644
index 0000000..f382a01
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic_fullpath-stderr.txt
@@ -0,0 +1,4 @@
+initial-cache.txt: CMAKE_SOURCE_DIR: .*/Tests/RunCMake/CommandLine
+initial-cache.txt: CMAKE_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic_fullpath-build
+CMakeLists.txt: INITIAL_SOURCE_DIR: .*/Tests/RunCMake/CommandLine
+CMakeLists.txt: INITIAL_BINARY_DIR: .*/Tests/RunCMake/CommandLine/C_basic_fullpath-build
diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt b/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt
new file mode 100644
index 0000000..32724f5
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic_fullpath-stdout.txt
@@ -0,0 +1 @@
+loading initial cache file .*/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt
diff --git a/Tests/RunCMake/CommandLine/C_basic_fullpath.cmake b/Tests/RunCMake/CommandLine/C_basic_fullpath.cmake
new file mode 100644
index 0000000..1a56593
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic_fullpath.cmake
@@ -0,0 +1,2 @@
+message("CMakeLists.txt: INITIAL_SOURCE_DIR: ${INITIAL_SOURCE_DIR}")
+message("CMakeLists.txt: INITIAL_BINARY_DIR: ${INITIAL_BINARY_DIR}")
diff --git a/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt b/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt
new file mode 100644
index 0000000..e7a8ac9
--- /dev/null
+++ b/Tests/RunCMake/CommandLine/C_basic_initial-cache.txt
@@ -0,0 +1,5 @@
+set(INITIAL_SOURCE_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "defined in initial.cmake")
+set(INITIAL_BINARY_DIR "${CMAKE_BINARY_DIR}" CACHE PATH "defined in initial.cmake")
+
+message("initial-cache.txt: CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}")
+message("initial-cache.txt: CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR}")
diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt
index 0d8f72e..4720a6f 100644
--- a/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt
+++ b/Tests/RunCMake/CommandLine/C_buildsrcdir-stderr.txt
@@ -1,8 +1,8 @@
 initial-cache.txt: CMAKE_SOURCE_DIR: .*/C_buildsrcdir/src
-initial-cache.txt: CMAKE_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir
+initial-cache.txt: CMAKE_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir
 PreLoad.cmake: CMAKE_SOURCE_DIR: .*/C_buildsrcdir/src
-PreLoad.cmake: CMAKE_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir
+PreLoad.cmake: CMAKE_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir
 CMakeLists.txt: INITIAL_SOURCE_DIR: .*/C_buildsrcdir/src
-CMakeLists.txt: INITIAL_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir
+CMakeLists.txt: INITIAL_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir
 CMakeLists.txt: PRELOAD_SOURCE_DIR: .*/C_buildsrcdir/src
-CMakeLists.txt: PRELOAD_BINARY_DIR: .*/C_buildsrcdir-build/DummyBuildDir
+CMakeLists.txt: PRELOAD_BINARY_DIR: .*/ExplicitDirs-build/DummyBuildDir
diff --git a/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt b/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt
index c69b11e..862cfeb 100644
--- a/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt
+++ b/Tests/RunCMake/CommandLine/C_buildsrcdir-stdout.txt
@@ -1,2 +1,2 @@
-loading initial cache file .*/C_buildsrcdir/initial-cache.txt
+loading initial cache file .*initial-cache.txt
 .*
diff --git a/Tests/RunCMake/CommandLine/Cno-file-stderr.txt b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt
index 67a2032..416686c 100644
--- a/Tests/RunCMake/CommandLine/Cno-file-stderr.txt
+++ b/Tests/RunCMake/CommandLine/Cno-file-stderr.txt
@@ -1,3 +1,3 @@
-^CMake Error: Error processing file: nosuchcachefile.txt
+^CMake Error: Error processing file: .*/Tests/RunCMake/CommandLine/Cno-file-build/nosuchcachefile.txt
 CMake Error: The source directory ".*/Tests/RunCMake/CommandLine/Cno-file-build" does not appear to contain CMakeLists.txt.
 Specify --help for usage, or press the help button on the CMake GUI.$
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
index efd1cc2..b608d33 100644
--- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake
@@ -110,6 +110,14 @@
   file(REMOVE_RECURSE "${binary_dir}")
   run_cmake_with_options(B-S -B${binary_dir} -S${source_dir})
 
+  message("copied to ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt")
+  file(COPY ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt DESTINATION ${RunCMake_TEST_BINARY_DIR})
+
+  # CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified.
+  # Path to initial-cache.txt is relative to the $PWD, which is normally set to ${RunCMake_TEST_BINARY_DIR}.
+  run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C initial-cache.txt)
+  # Test that full path works, too.
+  run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_TEST_BINARY_DIR}/initial-cache.txt)
 endfunction()
 run_ExplicitDirs()
 
@@ -406,9 +414,10 @@
 # Tests the values of CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR CMAKE_SOURCE_DIR CMAKE_CURRENT_SOURCE_DIR.
 run_cmake_command(P_working-dir ${CMAKE_COMMAND} -DEXPECTED_WORKING_DIR=${RunCMake_BINARY_DIR}/P_working-dir-build -P ${RunCMake_SOURCE_DIR}/P_working-dir.cmake -S something_else -B something_else_1)
 
-# CMAKE_BINARY_DIR should be determined by -B if specified, and CMAKE_SOURCE_DIR determined by -S if specified.
-run_cmake_with_options(C_buildsrcdir -B DummyBuildDir -S ${RunCMake_SOURCE_DIR}/C_buildsrcdir/src -C ${RunCMake_SOURCE_DIR}/C_buildsrcdir/initial-cache.txt)
-
+# Place an initial cache where C_basic will find it when passed the relative path "..".
+file(COPY ${RunCMake_SOURCE_DIR}/C_basic_initial-cache.txt DESTINATION ${RunCMake_BINARY_DIR})
+run_cmake_with_options(C_basic -C ../C_basic_initial-cache.txt)
+run_cmake_with_options(C_basic_fullpath -C ${RunCMake_BINARY_DIR}/C_basic_initial-cache.txt)
 
 set(RunCMake_TEST_OPTIONS
   "-DFOO=-DBAR:BOOL=BAZ")
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
index 44fe2da..e0b753a 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage-check.cmake
@@ -15,3 +15,17 @@
   set(RunCMake_TEST_FAILED "Generated foobar C++ pch header ${foobar_pch_hxx_header} does not exist")
   return()
 endif()
+
+file(STRINGS ${foobar_pch_h_header} foobar_pch_h_header_strings)
+
+if (NOT foobar_pch_h_header_strings MATCHES ";#include <stddef.h>(;|$)")
+  set(RunCMake_TEST_FAILED "Generated foo pch header\n  ${foobar_pch_h_header}\nhas bad content:\n  ${foobar_pch_h_header_strings}")
+  return()
+endif()
+
+file(STRINGS ${foobar_pch_hxx_header} foobar_pch_hxx_header_strings)
+
+if (NOT foobar_pch_hxx_header_strings MATCHES ";#include <cstddef>(;|$)")
+  set(RunCMake_TEST_FAILED "Generated foo pch header\n  ${foobar_pch_hxx_header}\nhas bad content:\n  ${foobar_pch_hxx_header_strings}")
+  return()
+endif()
diff --git a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
index 7a837da..cdc42b2 100644
--- a/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
+++ b/Tests/RunCMake/PrecompileHeaders/PchMultilanguage.cmake
@@ -6,4 +6,7 @@
   main.cpp
 )
 target_include_directories(foobar PUBLIC include)
-target_precompile_headers(foobar PRIVATE "<stddef.h>")
+target_precompile_headers(foobar PRIVATE
+  "$<$<COMPILE_LANGUAGE:C>:<stddef.h$<ANGLE-R>>"
+  "$<$<COMPILE_LANGUAGE:CXX>:<cstddef$<ANGLE-R>>"
+  )