Merge topic 'test-execute_process-abnormal-exit'

151a7d63dd Tests: Cover execute_process with abnormal exit on all platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9518
diff --git a/.gitlab/.gitignore b/.gitlab/.gitignore
index 552c02c..0558700 100644
--- a/.gitlab/.gitignore
+++ b/.gitlab/.gitignore
@@ -10,6 +10,7 @@
 /mingw
 /msvc*
 /ninja*
+/nuget
 /openmp
 /open-watcom*
 /orangec
diff --git a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
index 8b92bb2..d2064e6 100644
--- a/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
+++ b/.gitlab/ci/configure_windows_vs2022_x64_ninja.cmake
@@ -3,6 +3,7 @@
 
 if (NOT "$ENV{CMAKE_CI_NIGHTLY}" STREQUAL "")
   set(CMake_TEST_CPACK_INNOSETUP "ON" CACHE STRING "")
+  set(CMake_TEST_CPACK_NUGET "ON" CACHE STRING "")
   set(CMake_TEST_ISPC "ON" CACHE STRING "")
   set(CMake_TEST_Swift "ON" CACHE STRING "")
 endif()
diff --git a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1 b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
index ae4a058..fe010eb 100644
--- a/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
+++ b/.gitlab/ci/env_windows_vs2022_x64_ninja.ps1
@@ -1,6 +1,7 @@
 if ("$env:CMAKE_CI_NIGHTLY" -eq "true") {
   . ".gitlab/ci/innosetup-env.ps1"
   . ".gitlab/ci/ispc-env.ps1"
+  . ".gitlab/ci/nuget-env.ps1"
   . ".gitlab/ci/swift-env.ps1"
 }
 
diff --git a/.gitlab/ci/nuget-env.ps1 b/.gitlab/ci/nuget-env.ps1
new file mode 100644
index 0000000..7dee5a0
--- /dev/null
+++ b/.gitlab/ci/nuget-env.ps1
@@ -0,0 +1,4 @@
+$pwdpath = $pwd.Path
+& "$pwsh" -File ".gitlab/ci/nuget.ps1"
+Set-Item -Force -Path "env:PATH" -Value "$pwdpath\.gitlab\nuget;$env:PATH"
+nuget | Select -First 1
diff --git a/.gitlab/ci/nuget.ps1 b/.gitlab/ci/nuget.ps1
new file mode 100644
index 0000000..1decb01
--- /dev/null
+++ b/.gitlab/ci/nuget.ps1
@@ -0,0 +1,21 @@
+$erroractionpreference = "stop"
+
+$version = "6.9.1.3"
+$sha256sum = "562A2CE2D570D68DB4472CB82CDF1FC4245D5C73B84BC8361880CBE389702F65"
+$filename = "nuget-$version-win-i386-1"
+$tarball = "$filename.zip"
+
+$outdir = $pwd.Path
+$outdir = "$outdir\.gitlab"
+$ProgressPreference = 'SilentlyContinue'
+# This URL is only visible inside of Kitware's network.
+Invoke-WebRequest -Uri "https://cmake.org/files/dependencies/internal/$tarball" -OutFile "$outdir\$tarball"
+$hash = Get-FileHash "$outdir\$tarball" -Algorithm SHA256
+if ($hash.Hash -ne $sha256sum) {
+    exit 1
+}
+
+Add-Type -AssemblyName System.IO.Compression.FileSystem
+[System.IO.Compression.ZipFile]::ExtractToDirectory("$outdir\$tarball", "$outdir")
+Move-Item -Path "$outdir\$filename" -Destination "$outdir\nuget"
+Remove-Item "$outdir\$tarball"
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 5021851..9ee1d01 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -156,8 +156,9 @@
   Specify flags of the form :option:`-DVAR:TYPE=VALUE <cmake -D>` to be passed
   to the :manual:`cmake(1)` command-line used to drive the test build.
   The above example shows how values for variables
-  ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``, and ``LINK_LIBRARIES``
-  are used.
+  ``COMPILE_DEFINITIONS``, ``INCLUDE_DIRECTORIES``, ``LINK_DIRECTORIES``,
+  ``LINK_LIBRARIES``, and ``LINK_OPTIONS`` are used. Compiler options
+  can be passed in like `CMAKE_FLAGS -DCOMPILE_DEFINITIONS=-Werror`.
 
 ``COMPILE_DEFINITIONS <defs>...``
   Specify ``-Ddefinition`` arguments to pass to :command:`add_definitions`
diff --git a/Help/release/dev/FindPython-DEBUG.rst b/Help/release/dev/FindPython-DEBUG.rst
new file mode 100644
index 0000000..2e75e72
--- /dev/null
+++ b/Help/release/dev/FindPython-DEBUG.rst
@@ -0,0 +1,20 @@
+FindPython-DEBUG
+----------------
+
+* The :module:`FindPython`, :module:`FindPython2` and :module:`FindPython3`
+  modules offer, on ``Windows`` platform, a better support of the ``Python``
+  debug version:
+
+  * new variables:
+
+    * ``Python_EXECUTABLE_DEBUG``
+    * ``Python_INTERPRETER``
+    * ``Python_DEBUG_POSTFIX``
+
+  * new targets:
+
+    * ``Python::InterpreterDebug``
+    * ``Python::InterpreterMultiConfig``
+
+  And the ``python_add_library()`` command manage the :prop_tgt:`DEBUG_POSTFIX`
+  target property based on the value of the ``Python_DEBUG_POSTFIX`` variable.
diff --git a/Modules/Compiler/IntelLLVM-CXX.cmake b/Modules/Compiler/IntelLLVM-CXX.cmake
index 989a1d4..45e5d66 100644
--- a/Modules/Compiler/IntelLLVM-CXX.cmake
+++ b/Modules/Compiler/IntelLLVM-CXX.cmake
@@ -49,11 +49,21 @@
 
   set(CMAKE_CXX_STANDARD_LATEST 20)
 
-  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
+    set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-std=c++23")
+    set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++23")
+    set(CMAKE_CXX_STANDARD_LATEST 23)
+  elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
     set(CMAKE_CXX23_STANDARD_COMPILE_OPTION  "-std=c++2b")
     set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-std=gnu++2b")
     set(CMAKE_CXX_STANDARD_LATEST 23)
   endif()
+
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
+    set(CMAKE_CXX26_STANDARD_COMPILE_OPTION "-std=c++26")
+    set(CMAKE_CXX26_EXTENSION_COMPILE_OPTION "-std=gnu++26")
+    set(CMAKE_CXX_STANDARD_LATEST 26)
+  endif()
 else()
   set(CMAKE_CXX98_STANDARD_COMPILE_OPTION  "")
   set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "")
@@ -72,11 +82,22 @@
 
   set(CMAKE_CXX_STANDARD_LATEST 20)
 
-  if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
+    set(CMAKE_CXX23_STANDARD_COMPILE_OPTION "-Qstd=c++23")
+    set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-Qstd=c++23")
+    set(CMAKE_CXX_STANDARD_LATEST 23)
+  elseif(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.2.0)
     set(CMAKE_CXX23_STANDARD_COMPILE_OPTION  "-Qstd:c++2b")
     set(CMAKE_CXX23_EXTENSION_COMPILE_OPTION "-Qstd:c++2b")
     set(CMAKE_CXX_STANDARD_LATEST 23)
   endif()
+
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2024.0.0)
+    set(CMAKE_CXX26_STANDARD_COMPILE_OPTION "-Qstd=c++26")
+    set(CMAKE_CXX26_EXTENSION_COMPILE_OPTION "-Qstd=c++26")
+    set(CMAKE_CXX_STANDARD_LATEST 26)
+  endif()
+
 endif()
 
 __compiler_check_default_language_standard(CXX 2020 14)
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 3323b18..e3fc59c 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -2297,7 +2297,16 @@
   set(suffix "")
   get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
   if(_isMultiConfig)
-    set(suffix "/$<CONFIG>")
+    if(CMAKE_GENERATOR STREQUAL "Xcode")
+      # The Xcode generator does not support per-config sources,
+      # so use the underlying build system's placeholder instead.
+      # FIXME(#23652): We have no test for the use case requiring
+      # CMAKE_CFG_INTDIR for XCODE_EMIT_EFFECTIVE_PLATFORM_NAME,
+      # but $<CONFIG> does not work.
+      set(suffix "/${CMAKE_CFG_INTDIR}")
+    else()
+      set(suffix "/$<CONFIG>")
+    endif()
   endif()
   set(${suffix_var} "${suffix}" PARENT_SCOPE)
 endfunction()
diff --git a/Modules/FindPython.cmake b/Modules/FindPython.cmake
index 19b6c2a..b963ef5 100644
--- a/Modules/FindPython.cmake
+++ b/Modules/FindPython.cmake
@@ -77,9 +77,25 @@
   :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
 
 ``Python::Interpreter``
-  Python interpreter. Target defined if component ``Interpreter`` is found.
+  Python interpreter. This target is defined only if the ``Interpreter``
+  component is found.
+``Python::InterpreterDebug``
+  .. versionadded:: 3.30
+
+  Python debug interpreter. This target is defined only if the ``Interpreter``
+  component is found and the ``Python_EXECUTABLE_DEBUG`` variable is defined.
+  The target is only defined on the ``Windows`` platform.
+
+``Python::InterpreterMultiConfig``
+  .. versionadded:: 3.30
+
+  Python interpreter. The release or debug version of the interpreter will be
+  used, based on the context (platform, configuration).
+  This target is defined only if the ``Interpreter`` component is found
+
 ``Python::Compiler``
-  Python compiler. Target defined if component ``Compiler`` is found.
+  Python compiler. This target is defined only if the ``Compiler`` component is
+  found.
 
 ``Python::Module``
   .. versionadded:: 3.15
@@ -114,6 +130,20 @@
   System has the Python interpreter.
 ``Python_EXECUTABLE``
   Path to the Python interpreter.
+``Python_EXECUTABLE_DEBUG``
+  .. versionadded:: 3.30
+
+  Path to the debug Python interpreter. It is only defined on the ``Windows``
+  platform.
+
+``Python_INTERPRETER``
+  .. versionadded:: 3.30
+
+  Path to the Python interpreter, defined as a
+  :manual:`generator expression <cmake-generator-expressions(7)>` selecting
+  the ``Python_EXECUTABLE`` or ``Python_EXECUTABLE_DEBUG`` variable based on
+  the context (platform, configuration).
+
 ``Python_INTERPRETER_ID``
   A short string unique to the interpreter. Possible values include:
     * Python
@@ -194,6 +224,12 @@
 
   The Python include directories.
 
+``Python_DEBUG_POSTFIX``
+  .. versionadded.. 3.30
+
+  Postfix of debug python module. This variable can be used to define the
+  :prop_tgt:`DEBUG_POSTFIX` target property.
+
 ``Python_LINK_OPTIONS``
   .. versionadded:: 3.19
 
@@ -537,6 +573,10 @@
 
   When option ``WITH_SOABI`` is also specified,  the module suffix will include
   the ``Python_SOSABI`` value, if any.
+
+.. versionadded:: 3.30
+  For ``MODULE`` type, the :prop_tgt:`DEBUG_POSTFIX` target property is
+  initialized with the value of ``Python_DEBUG_POSTFIX`` variable if defined.
 #]=======================================================================]
 
 
diff --git a/Modules/FindPython/Support.cmake b/Modules/FindPython/Support.cmake
index 410b736..d05d27b 100644
--- a/Modules/FindPython/Support.cmake
+++ b/Modules/FindPython/Support.cmake
@@ -360,7 +360,11 @@
   foreach (implementation IN LISTS _PGN_IMPLEMENTATIONS)
     if (implementation STREQUAL "CPython")
       if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "FIRST")
-        list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+        if (_PGN_DEBUG)
+          list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}_d python_d)
+        else()
+          list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+        endif()
       endif()
       foreach (version IN LISTS _PGN_VERSION)
         if (_PGN_WIN32)
@@ -412,7 +416,11 @@
         endif()
       endforeach()
       if (_PGN_INTERPRETER AND _${_PYTHON_PREFIX}_FIND_UNVERSIONED_NAMES STREQUAL "LAST")
-        list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+        if (_PGN_DEBUG)
+          list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR}_d python_d)
+        else()
+          list (APPEND names python${_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR} python)
+        endif()
       endif()
     elseif (implementation STREQUAL "IronPython")
       if (_PGN_INTERPRETER)
@@ -458,7 +466,7 @@
 function (_PYTHON_GET_CONFIG_VAR _PYTHON_PGCV_VALUE NAME)
   unset (${_PYTHON_PGCV_VALUE} PARENT_SCOPE)
 
-  if (NOT NAME MATCHES "^(PREFIX|ABIFLAGS|CONFIGDIR|INCLUDES|LIBS|SOABI|SOSABI)$")
+  if (NOT NAME MATCHES "^(PREFIX|ABIFLAGS|CONFIGDIR|INCLUDES|LIBS|SOABI|SOSABI|POSTFIX)$")
     return()
   endif()
 
@@ -494,7 +502,7 @@
         if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
           set(_values "")
         else()
-          string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+          string (REGEX REPLACE "^([.-]|_d\\.)(.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\2" _values "${_values}")
         endif()
       endif()
     endif()
@@ -545,7 +553,7 @@
           if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
             set(_values "")
           else()
-            string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+            string (REGEX REPLACE "^([.-]|_d\\.)(.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\2" _values "${_values}")
           endif()
         endif()
       endif()
@@ -572,7 +580,7 @@
             if (_values MATCHES "^(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.so|\\.pyd)$")
               set(_values "")
             else()
-              string (REGEX REPLACE "^[.-](.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
+              string (REGEX REPLACE "^([.-]|_d\\.)(.+)(${CMAKE_SHARED_LIBRARY_SUFFIX}|\\.(so|pyd))$" "\\1" _values "${_values}")
             endif()
           endif()
         endif()
@@ -588,6 +596,10 @@
       else()
         string (REGEX REPLACE "^\\.(.+)\\.[^.]+$" "\\1" _values "${_values}")
       endif()
+    elseif (NAME STREQUAL "POSTFIX")
+      if (WIN32 AND _${_PYTHON_PREFIX}_LIBRARY_DEBUG MATCHES "_d${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
+        set (_values "_d")
+      endif()
     else()
       set (config_flag "${NAME}")
       if (NAME STREQUAL "CONFIGDIR")
@@ -605,7 +617,7 @@
     endif()
   endif()
 
-  if (NAME STREQUAL "ABIFLAGS" OR NAME STREQUAL "SOABI" OR NAME STREQUAL "SOSABI")
+  if (NAME STREQUAL "ABIFLAGS" OR NAME STREQUAL "SOABI" OR NAME STREQUAL "SOSABI" OR NAME STREQUAL "POSTFIX")
     set (${_PYTHON_PGCV_VALUE} "${_values}" PARENT_SCOPE)
     return()
   endif()
@@ -817,6 +829,7 @@
 
 function (_PYTHON_VALIDATE_INTERPRETER)
   if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
+    unset (_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG CACHE)
     return()
   endif()
 
@@ -826,6 +839,9 @@
     # interpreter does not exist anymore
     set_property (CACHE _${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE PROPERTY VALUE "Cannot find the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
     set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+    if (WIN32)
+      set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE_DEBUG PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE_DEBUG-NOTFOUND")
+    endif()
     return()
   endif()
 
@@ -863,6 +879,9 @@
       # interpreter is not usable
       set_property (CACHE _${_PYTHON_PREFIX}_Interpreter_REASON_FAILURE PROPERTY VALUE "Cannot use the interpreter \"${_${_PYTHON_PREFIX}_EXECUTABLE}\"")
       set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE-NOTFOUND")
+      if (WIN32)
+        set_property (CACHE _${_PYTHON_PREFIX}_EXECUTABLE_DEBUG PROPERTY VALUE "${_PYTHON_PREFIX}_EXECUTABLE_DEBUG-NOTFOUND")
+      endif()
       return()
     endif()
 
@@ -1106,7 +1125,7 @@
 
 function (_PYTHON_VALIDATE_LIBRARY)
   if (NOT _${_PYTHON_PREFIX}_LIBRARY_RELEASE)
-    unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG)
+    unset (_${_PYTHON_PREFIX}_LIBRARY_DEBUG CACHE)
     return()
   endif()
 
@@ -1173,7 +1192,7 @@
 
 function (_PYTHON_VALIDATE_SABI_LIBRARY)
   if (NOT _${_PYTHON_PREFIX}_SABI_LIBRARY_RELEASE)
-    unset (_${_PYTHON_PREFIX}_SABI_LIBRARY_DEBUG)
+    unset (_${_PYTHON_PREFIX}_SABI_LIBRARY_DEBUG CACHE)
     return()
   endif()
 
@@ -1452,6 +1471,9 @@
 unset (${_PYTHON_PREFIX}_SOABI)
 unset (${_PYTHON_PREFIX}_SOSABI)
 
+# Windows CPython implementation may be requiring a postfix in debug mode
+unset (${_PYTHON_PREFIX}_DEBUG_POSTFIX)
+
 # Define lookup strategy
 cmake_policy (GET CMP0094 _${_PYTHON_PREFIX}_LOOKUP_POLICY)
 if (_${_PYTHON_PREFIX}_LOOKUP_POLICY STREQUAL "NEW")
@@ -1788,6 +1810,7 @@
 # first step, search for the interpreter
 if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS)
   list (APPEND _${_PYTHON_PREFIX}_CACHED_VARS _${_PYTHON_PREFIX}_EXECUTABLE
+                                              _${_PYTHON_PREFIX}_EXECUTABLE_DEBUG
                                               _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES)
   if (${_PYTHON_PREFIX}_FIND_REQUIRED_Interpreter)
     list (APPEND _${_PYTHON_PREFIX}_REQUIRED_VARS ${_PYTHON_PREFIX}_EXECUTABLE)
@@ -1800,6 +1823,7 @@
       unset (_${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES CACHE)
     endif()
     set (_${_PYTHON_PREFIX}_EXECUTABLE "${${_PYTHON_PREFIX}_EXECUTABLE}" CACHE INTERNAL "")
+    unset (_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG CACHE)
   elseif (DEFINED _${_PYTHON_PREFIX}_EXECUTABLE)
     # compute interpreter signature and check validity of definition
     string (MD5 __${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE "${_${_PYTHON_PREFIX}_SIGNATURE}:${_${_PYTHON_PREFIX}_EXECUTABLE}")
@@ -1816,6 +1840,7 @@
       endif()
     else()
       unset (_${_PYTHON_PREFIX}_EXECUTABLE CACHE)
+      unset (_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG CACHE)
     endif()
     if (NOT _${_PYTHON_PREFIX}_EXECUTABLE)
       unset (_${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE CACHE)
@@ -2263,7 +2288,30 @@
     set (${_PYTHON_PREFIX}_EXECUTABLE "${_${_PYTHON_PREFIX}_EXECUTABLE}" CACHE FILEPATH "${_PYTHON_PREFIX} Interpreter")
   endif()
 
+  if (WIN32 AND _${_PYTHON_PREFIX}_EXECUTABLE AND "CPython" IN_LIST _${_PYTHON_PREFIX}_FIND_IMPLEMENTATIONS)
+    # search for debug interpreter
+    # use release interpreter location as a hint
+    _python_get_names (_${_PYTHON_PREFIX}_INTERPRETER_NAMES_DEBUG VERSION ${_${_PYTHON_PREFIX}_FIND_VERSIONS} IMPLEMENTATIONS CPython INTERPRETER WIN32 DEBUG)
+    get_filename_component (_${_PYTHON_PREFIX}_PATH "${_${_PYTHON_PREFIX}_EXECUTABLE}" DIRECTORY)
+    set (_${_PYTHON_PREFIX}_HINTS "${${_PYTHON_PREFIX}_ROOT_DIR}" ENV ${_PYTHON_PREFIX}_ROOT_DIR)
+
+    find_program (_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG
+                  NAMES ${_${_PYTHON_PREFIX}_INTERPRETER_NAMES_DEBUG}
+                  NAMES_PER_DIR
+                  HINTS "${_${_PYTHON_PREFIX}_PATH}" ${${_PYTHON_PREFIX}_HINTS}
+                  NO_DEFAULT_PATH)
+    # second try including CMAKE variables to catch-up non conventional layouts
+    find_program (_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG
+                  NAMES ${_${_PYTHON_PREFIX}_INTERPRETER_NAMES_DEBUG}
+                  NAMES_PER_DIR
+                  NO_SYSTEM_ENVIRONMENT_PATH
+                  NO_CMAKE_SYSTEM_PATH)
+  endif()
+  set (${_PYTHON_PREFIX}_EXECUTABLE_DEBUG "${_${_PYTHON_PREFIX}_EXECUTABLE_DEBUG}")
+  set (${_PYTHON_PREFIX}_INTERPRETER "$<IF:$<AND:$<CONFIG:Debug>,$<BOOL:${WIN32}>,$<BOOL:${${_PYTHON_PREFIX}_EXECUTABLE_DEBUG}>>,${${_PYTHON_PREFIX}_EXECUTABLE_DEBUG},${${_PYTHON_PREFIX}_EXECUTABLE}>")
+
   _python_mark_as_internal (_${_PYTHON_PREFIX}_EXECUTABLE
+                            _${_PYTHON_PREFIX}_EXECUTABLE_DEBUG
                             _${_PYTHON_PREFIX}_INTERPRETER_PROPERTIES
                             _${_PYTHON_PREFIX}_INTERPRETER_SIGNATURE)
 endif()
@@ -3730,6 +3778,10 @@
     _python_get_config_var (${_PYTHON_PREFIX}_SOSABI SOSABI)
   endif()
 
+  if (WIN32 AND NOT DEFINED ${_PYTHON_PREFIX}_DEBUG_POSTFIX)
+    _python_get_config_var (${_PYTHON_PREFIX}_DEBUG_POSTFIX POSTFIX)
+  endif()
+
   _python_compute_development_signature (Module)
   _python_compute_development_signature (SABIModule)
   _python_compute_development_signature (Embed)
@@ -3892,11 +3944,27 @@
 # Create imported targets and helper functions
 if(_${_PYTHON_PREFIX}_CMAKE_ROLE STREQUAL "PROJECT")
   if ("Interpreter" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
-      AND ${_PYTHON_PREFIX}_Interpreter_FOUND
-      AND NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
-    add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
-    set_property (TARGET ${_PYTHON_PREFIX}::Interpreter
-                  PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
+      AND ${_PYTHON_PREFIX}_Interpreter_FOUND)
+    if(NOT TARGET ${_PYTHON_PREFIX}::Interpreter)
+      add_executable (${_PYTHON_PREFIX}::Interpreter IMPORTED)
+      set_property (TARGET ${_PYTHON_PREFIX}::Interpreter
+                    PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
+    endif()
+    if(${_PYTHON_PREFIX}_EXECUTABLE_DEBUG AND NOT TARGET ${_PYTHON_PREFIX}::InterpreterDebug)
+      add_executable (${_PYTHON_PREFIX}::InterpreterDebug IMPORTED)
+      set_property (TARGET ${_PYTHON_PREFIX}::InterpreterDebug
+                    PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE_DEBUG}")
+    endif()
+    if(NOT TARGET ${_PYTHON_PREFIX}::InterpreterMultiConfig)
+      add_executable (${_PYTHON_PREFIX}::InterpreterMultiConfig IMPORTED)
+      set_property (TARGET ${_PYTHON_PREFIX}::InterpreterMultiConfig
+                    PROPERTY IMPORTED_LOCATION "${${_PYTHON_PREFIX}_EXECUTABLE}")
+      if(${_PYTHON_PREFIX}_EXECUTABLE_DEBUG)
+        set_target_properties (${_PYTHON_PREFIX}::InterpreterMultiConfig
+                               PROPERTIES IMPORTED_CONFIGURATIONS DEBUG
+                                          IMPORTED_LOCATION_DEBUG "${${_PYTHON_PREFIX}_EXECUTABLE_DEBUG}")
+      endif()
+    endif()
   endif()
 
   if ("Compiler" IN_LIST ${_PYTHON_PREFIX}_FIND_COMPONENTS
@@ -4108,6 +4176,9 @@
         set_property (TARGET ${name} PROPERTY PREFIX "")
         if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
           set_property (TARGET ${name} PROPERTY SUFFIX ".pyd")
+          if (${prefix}_DEBUG_POSTFIX)
+            set_property (TARGET ${name} PROPERTY DEBUG_POSTFIX "${${prefix}_DEBUG_POSTFIX}")
+          endif()
         endif()
 
         if (PYTHON_ADD_LIBRARY_WITH_SOABI)
diff --git a/Modules/FindPython2.cmake b/Modules/FindPython2.cmake
index 4c7ab5c..eb2b5a8 100644
--- a/Modules/FindPython2.cmake
+++ b/Modules/FindPython2.cmake
@@ -71,9 +71,25 @@
   :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
 
 ``Python2::Interpreter``
-  Python 2 interpreter. Target defined if component ``Interpreter`` is found.
+  Python 2 interpreter. This target is defined only if the ``Interpreter``
+  component is found.
+``Python2::InterpreterDebug``
+  .. versionadded:: 3.30
+
+  Python 2 debug interpreter. This target is defined only if the
+  ``Interpreter`` component is found and the ``Python2_EXECUTABLE_DEBUG``
+  variable is defined. The target is only defined on the ``Windows`` platform.
+
+``Python2::InterpreterMultiConfig``
+  .. versionadded:: 3.30
+
+  Python 2 interpreter. The release or debug version of the interpreter will be
+  used, based on the context (platform, configuration).
+  This target is defined only if the ``Interpreter`` component is found
+
 ``Python2::Compiler``
-  Python 2 compiler. Target defined if component ``Compiler`` is found.
+  Python 2 compiler. This target is defined only if the ``Compiler`` component
+  is found.
 ``Python2::Module``
   .. versionadded:: 3.15
 
@@ -101,6 +117,20 @@
   System has the Python 2 interpreter.
 ``Python2_EXECUTABLE``
   Path to the Python 2 interpreter.
+``Python2_EXECUTABLE_DEBUG``
+  .. versionadded:: 3.30
+
+  Path to the debug Python 2 interpreter. It is only defined on the ``Windows``
+  platform.
+
+``Python2_INTERPRETER``
+  .. versionadded:: 3.30
+
+  Path to the Python 2 interpreter, defined as a
+  :manual:`generator expression <cmake-generator-expressions(7)>` selecting
+  the ``Python2_EXECUTABLE`` or ``Python2_EXECUTABLE_DEBUG`` variable based on
+  the context (platform, configuration).
+
 ``Python2_INTERPRETER_ID``
   A short string unique to the interpreter. Possible values include:
     * Python
@@ -158,6 +188,12 @@
 ``Python2_INCLUDE_DIRS``
   The Python 2 include directories.
 
+``Python2_DEBUG_POSTFIX``
+  .. versionadded.. 3.30
+
+  Postfix of debug python module. This variable can be used to define the
+  :prop_tgt:`DEBUG_POSTFIX` target property.
+
 ``Python2_LINK_OPTIONS``
   .. versionadded:: 3.19
 
@@ -417,6 +453,10 @@
                        <source1> [<source2> ...])
 
 If library type is not specified, ``MODULE`` is assumed.
+
+.. versionadded:: 3.30
+  For ``MODULE`` type, the :prop_tgt:`DEBUG_POSTFIX` target property is
+  initialized with the value of ``Python2_DEBUG_POSTFIX`` variable if defined.
 #]=======================================================================]
 
 
diff --git a/Modules/FindPython3.cmake b/Modules/FindPython3.cmake
index 901565b..b2a5b09 100644
--- a/Modules/FindPython3.cmake
+++ b/Modules/FindPython3.cmake
@@ -78,9 +78,25 @@
   :prop_gbl:`CMAKE_ROLE` is ``PROJECT``.
 
 ``Python3::Interpreter``
-  Python 3 interpreter. Target defined if component ``Interpreter`` is found.
+  Python 3 interpreter. This target is defined only if the ``Interpreter``
+  component is found.
+``Python3::InterpreterDebug``
+  .. versionadded:: 3.30
+
+  Python 3 debug interpreter. This target is defined only if the
+  ``Interpreter`` component is found and the ``Python3_EXECUTABLE_DEBUG``
+  variable is defined. The target is only defined on the ``Windows`` platform.
+
+``Python3::InterpreterMultiConfig``
+  .. versionadded:: 3.30
+
+  Python 3 interpreter. The release or debug version of the interpreter will be
+  used, based on the context (platform, configuration).
+  This target is defined only if the ``Interpreter`` component is found
+
 ``Python3::Compiler``
-  Python 3 compiler. Target defined if component ``Compiler`` is found.
+  Python 3 compiler. This target is defined only if the ``Compiler`` component
+  is found.
 
 ``Python3::Module``
   .. versionadded:: 3.15
@@ -115,6 +131,20 @@
   System has the Python 3 interpreter.
 ``Python3_EXECUTABLE``
   Path to the Python 3 interpreter.
+``Python3_EXECUTABLE_DEBUG``
+  .. versionadded:: 3.30
+
+  Path to the debug Python 3 interpreter. It is only defined on ``Windows``
+  platform.
+
+``Python3_INTERPRETER``
+  .. versionadded:: 3.30
+
+  Path to the Python 3 interpreter, defined as a
+  :manual:`generator expression <cmake-generator-expressions(7)>` selecting
+  the ``Python3_EXECUTABLE`` or ``Python3_EXECUTABLE_DEBUG`` variable based on
+  the context (platform, configuration).
+
 ``Python3_INTERPRETER_ID``
   A short string unique to the interpreter. Possible values include:
     * Python
@@ -196,6 +226,12 @@
 
   The Python 3 include directories.
 
+``Python3_DEBUG_POSTFIX``
+  .. versionadded.. 3.30
+
+  Postfix of debug python module. This variable can be used to define the
+  :prop_tgt:`DEBUG_POSTFIX` target property.
+
 ``Python3_LINK_OPTIONS``
   .. versionadded:: 3.19
 
@@ -535,6 +571,10 @@
 
   When option ``WITH_SOABI`` is also specified,  the module suffix will include
   the ``Python3_SOSABI`` value, if any.
+
+.. versionadded:: 3.30
+  For ``MODULE`` type, the :prop_tgt:`DEBUG_POSTFIX` target property is
+  initialized with the value of ``Python3_DEBUG_POSTFIX`` variable if defined.
 #]=======================================================================]
 
 
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 602fa67..0c28ffd 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 29)
-set(CMake_VERSION_PATCH 20240513)
+set(CMake_VERSION_PATCH 20240515)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 8681640..0ee2dac 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2730,6 +2730,7 @@
 }
 
 static bool RaiseCMP0037Message(cmake* cm, cmTarget* tgt,
+                                std::string const& targetNameAsWritten,
                                 std::string const& reason)
 {
   MessageType messageType = MessageType::AUTHOR_WARNING;
@@ -2750,8 +2751,8 @@
       break;
   }
   if (issueMessage) {
-    e << "The target name \"" << tgt->GetName() << "\" is reserved " << reason
-      << ".";
+    e << "The target name \"" << targetNameAsWritten << "\" is reserved "
+      << reason << ".";
     if (messageType == MessageType::AUTHOR_WARNING) {
       e << "  It may result in undefined behavior.";
     }
@@ -2770,7 +2771,8 @@
   if (!tgt) {
     return true;
   }
-  return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, reason);
+  return RaiseCMP0037Message(this->GetCMakeInstance(), tgt, targetName,
+                             reason);
 }
 
 void cmGlobalGenerator::CreateDefaultGlobalTargets(
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index d31f96d..9ff38bf 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -167,10 +167,7 @@
     set(CPACK_BINARY_DEB OFF)
   endif()
 
-  # Look for NuGet to use for tests.
-  find_program(NUGET_EXECUTABLE NAMES NuGet nuget)
-
-  if(NUGET_EXECUTABLE)
+  if(CMake_TEST_CPACK_NUGET)
     set(CPACK_BINARY_NUGET ON)
   else()
     set(CPACK_BINARY_NUGET OFF)
@@ -1115,9 +1112,7 @@
     if(CPACK_BINARY_DEB)
       list(APPEND ACTIVE_CPACK_GENERATORS DEB)
     endif()
-    # Check whether if NuGet command is found
-    # before adding NuGet tests
-    if(CPACK_BINARY_NUGET)
+    if(CMake_TEST_CPACK_NUGET)
       list(APPEND ACTIVE_CPACK_GENERATORS NUGET)
       set(CPACK_GENERATOR_STRING_NUGET NuGet)
     endif()
diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
index 18f8fda..f92db5f 100644
--- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
+++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestArtifactsInteractive LANGUAGES C)
 
diff --git a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt
index e0148f3..e9d14f5 100644
--- a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt
+++ b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestCustomFailureMessage LANGUAGES NONE)
 
diff --git a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
index 0fb3036..d72d258 100644
--- a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
+++ b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestCustomFailureMessage.Check LANGUAGES NONE)
 
diff --git a/Tests/FindPython/DifferentComponents/CMakeLists.txt b/Tests/FindPython/DifferentComponents/CMakeLists.txt
index e3e7b36..e72b4bf 100644
--- a/Tests/FindPython/DifferentComponents/CMakeLists.txt
+++ b/Tests/FindPython/DifferentComponents/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestDifferentComponents LANGUAGES C)
 
diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt
index 1bd94c4..e3bb43b 100644
--- a/Tests/FindPython/ExactVersion/CMakeLists.txt
+++ b/Tests/FindPython/ExactVersion/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestExactVersion LANGUAGES C)
 
diff --git a/Tests/FindPython/FindPythonScript.cmake b/Tests/FindPython/FindPythonScript.cmake
index 808496e..fa51f59 100644
--- a/Tests/FindPython/FindPythonScript.cmake
+++ b/Tests/FindPython/FindPythonScript.cmake
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.15)
 if (PYTHON_MUST_NOT_BE_FOUND)
   find_package(${PYTHON_PACKAGE_NAME} QUIET)
   if (${PYTHON_PACKAGE_NAME}_FOUND)
diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt
index 8086c16..da33034 100644
--- a/Tests/FindPython/Implementation/CMakeLists.txt
+++ b/Tests/FindPython/Implementation/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} LANGUAGES NONE)
 
diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt
index fd3182e..3c28527 100644
--- a/Tests/FindPython/IronPython/CMakeLists.txt
+++ b/Tests/FindPython/IronPython/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestIronPython LANGUAGES NONE)
 
diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt
index b623972..0a4dcb4 100644
--- a/Tests/FindPython/IronPython2/CMakeLists.txt
+++ b/Tests/FindPython/IronPython2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestIronPython2 LANGUAGES NONE)
 
diff --git a/Tests/FindPython/IronPython3/CMakeLists.txt b/Tests/FindPython/IronPython3/CMakeLists.txt
index b09097a..f39b84d 100644
--- a/Tests/FindPython/IronPython3/CMakeLists.txt
+++ b/Tests/FindPython/IronPython3/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestIronPython3 LANGUAGES NONE)
 
diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt
index 352a2f6f..6536e46 100644
--- a/Tests/FindPython/MultiplePackages/CMakeLists.txt
+++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestMultiplePackages C)
 
@@ -20,7 +20,7 @@
 
   add_test (NAME python2_spam2
             COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
-            "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
+            "${Python2_INTERPRETER}" -c "import spam2; spam2.system(\"cd\")")
 
 endif()
 
@@ -40,6 +40,6 @@
 
   add_test (NAME python3_spam3
             COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
-            "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+            "${Python3_INTERPRETER}" -c "import spam3; spam3.system(\"cd\")")
 
 endif()
diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt
index 336bb83..c5552d8 100644
--- a/Tests/FindPython/NumPy/CMakeLists.txt
+++ b/Tests/FindPython/NumPy/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestNumPy LANGUAGES C)
 
@@ -12,7 +12,7 @@
 
   add_test (NAME python2_arraytest
     COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest2>"
-    "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));")
+    "${Python2_INTERPRETER}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));")
 
 endif()
 
@@ -26,6 +26,6 @@
 
   add_test (NAME python3_arraytest
     COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest3>"
-    "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));")
+    "${Python3_INTERPRETER}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));")
 
 endif()
diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt
index 115cf2b..db7e68e 100644
--- a/Tests/FindPython/NumPyOnly/CMakeLists.txt
+++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestNumPyOnly LANGUAGES C)
 
diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt
index dfc22d8..2e8bc58 100644
--- a/Tests/FindPython/PyPy/CMakeLists.txt
+++ b/Tests/FindPython/PyPy/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPyPy LANGUAGES C)
 
diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt
index 5b7ce30..2d89531 100644
--- a/Tests/FindPython/PyPy2/CMakeLists.txt
+++ b/Tests/FindPython/PyPy2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPyPy2 LANGUAGES C)
 
diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt
index b702c99..93388a0 100644
--- a/Tests/FindPython/PyPy3/CMakeLists.txt
+++ b/Tests/FindPython/PyPy3/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPyPy3 LANGUAGES C)
 
diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt
index 85b1711..7074649 100644
--- a/Tests/FindPython/Python/CMakeLists.txt
+++ b/Tests/FindPython/Python/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython LANGUAGES C)
 
@@ -32,7 +32,7 @@
 
   add_test (NAME python_spam${Python_REQUESTED_VERSION}
             COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam${Python_REQUESTED_VERSION}>"
-            "${Python_EXECUTABLE}" -c "import spam${Python_REQUESTED_VERSION}; spam${Python_REQUESTED_VERSION}.system(\"cd\")")
+            "${Python_INTERPRETER}" -c "import spam${Python_REQUESTED_VERSION}; spam${Python_REQUESTED_VERSION}.system(\"cd\")")
 else()
   add_test(NAME findpython_script
            COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python
diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt
index 95ed495..f858574 100644
--- a/Tests/FindPython/Python2/CMakeLists.txt
+++ b/Tests/FindPython/Python2/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython2 LANGUAGES C)
 
@@ -39,7 +39,7 @@
 
 add_test (NAME python2_spam2
           COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>"
-          "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
+          "${Python2_INTERPRETER}" -c "import spam2; spam2.system(\"cd\")")
 
 add_test(NAME findpython2_script
          COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python2
diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt
index d9b2d22..0a04f70 100644
--- a/Tests/FindPython/Python2Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython2Embedded LANGUAGES C)
 
diff --git a/Tests/FindPython/Python2Fail/CMakeLists.txt b/Tests/FindPython/Python2Fail/CMakeLists.txt
index 7a6520d..7f7b906 100644
--- a/Tests/FindPython/Python2Fail/CMakeLists.txt
+++ b/Tests/FindPython/Python2Fail/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython2Fail C)
 
diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt
index 7334d7a..6fffad4 100644
--- a/Tests/FindPython/Python2Module/CMakeLists.txt
+++ b/Tests/FindPython/Python2Module/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython2Module LANGUAGES C)
 
@@ -34,4 +34,4 @@
 
 add_test (NAME python2_spam2
           COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>"
-          "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
+          "${Python2_INTERPRETER}" -c "import spam2; spam2.system(\"cd\")")
diff --git a/Tests/FindPython/Python2SABIModule/CMakeLists.txt b/Tests/FindPython/Python2SABIModule/CMakeLists.txt
index ffbaa33..c43dedc 100644
--- a/Tests/FindPython/Python2SABIModule/CMakeLists.txt
+++ b/Tests/FindPython/Python2SABIModule/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython2SABIModule LANGUAGES C)
 
diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt
index 42d31f2..53d8b12 100644
--- a/Tests/FindPython/Python3/CMakeLists.txt
+++ b/Tests/FindPython/Python3/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython3 LANGUAGES C)
 
@@ -39,7 +39,7 @@
 
 add_test (NAME python3_spam3
           COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
-          "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+          "${Python3_INTERPRETER}" -c "import spam3; spam3.system(\"cd\")")
 
 add_test(NAME findpython3_script
          COMMAND "${CMAKE_COMMAND}" -DPYTHON_PACKAGE_NAME=Python3
diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt
index 1d362be..46f7042 100644
--- a/Tests/FindPython/Python3Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython3Embedded LANGUAGES C)
 
diff --git a/Tests/FindPython/Python3Fail/CMakeLists.txt b/Tests/FindPython/Python3Fail/CMakeLists.txt
index 5eca0cb..810375b 100644
--- a/Tests/FindPython/Python3Fail/CMakeLists.txt
+++ b/Tests/FindPython/Python3Fail/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython3Fail C)
 
diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt
index 57c0ddf..e47a76a 100644
--- a/Tests/FindPython/Python3Module/CMakeLists.txt
+++ b/Tests/FindPython/Python3Module/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython3Module LANGUAGES C)
 
@@ -43,4 +43,4 @@
 
 add_test (NAME python3_spam3
           COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
-          "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+          "${Python3_INTERPRETER}" -c "import spam3; spam3.system(\"cd\")")
diff --git a/Tests/FindPython/Python3SABIModule/CMakeLists.txt b/Tests/FindPython/Python3SABIModule/CMakeLists.txt
index e045b69..77d3abc 100644
--- a/Tests/FindPython/Python3SABIModule/CMakeLists.txt
+++ b/Tests/FindPython/Python3SABIModule/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestPython3SABIModule LANGUAGES C)
 
@@ -52,4 +52,4 @@
 
 add_test (NAME python3_spam3
           COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
-          "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+          "${Python3_INTERPRETER}" -c "import spam3; spam3.system(\"cd\")")
diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
index eec28a5..5df01c6 100644
--- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestRequiredArtifacts LANGUAGES C)
 
diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
index 4d9c7c8..25bdcf3 100644
--- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestRequiredArtifacts.Check LANGUAGES C)
 
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 6c0e9a9..362df7f 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestSOABI LANGUAGES C)
 
diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt
index ea742ea..7837916 100644
--- a/Tests/FindPython/VirtualEnv/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestVirtualEnv LANGUAGES NONE)
 
diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake
index 020ecac..8f56d00 100644
--- a/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake
+++ b/Tests/FindPython/VirtualEnv/VirtualEnvDefault.cmake
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.15)
 
 find_package (Python3 REQUIRED)
 
diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake
index 29a4924..9ae4975 100644
--- a/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake
+++ b/Tests/FindPython/VirtualEnv/VirtualEnvOnly.cmake
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.15)
 
 #
 # Virtual environment is defined for python3
diff --git a/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake b/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake
index 89f27d8..353a91b 100644
--- a/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake
+++ b/Tests/FindPython/VirtualEnv/VirtualEnvStandard.cmake
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.15)
 
 set (Python3_FIND_VIRTUALENV STANDARD)
 find_package (Python3 REQUIRED)
diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
index 3a64c31..6482793 100644
--- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION 3.15)
 
 project(TestVirtualEnvConda LANGUAGES NONE)
 
diff --git a/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake b/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake
index 020ecac..8f56d00 100644
--- a/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake
+++ b/Tests/FindPython/VirtualEnvConda/VirtualEnvDefault.cmake
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.15)
 
 find_package (Python3 REQUIRED)
 
diff --git a/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake b/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake
index 29a4924..9ae4975 100644
--- a/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake
+++ b/Tests/FindPython/VirtualEnvConda/VirtualEnvOnly.cmake
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.15)
 
 #
 # Virtual environment is defined for python3
diff --git a/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake b/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake
index 89f27d8..353a91b 100644
--- a/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake
+++ b/Tests/FindPython/VirtualEnvConda/VirtualEnvStandard.cmake
@@ -1,3 +1,4 @@
+cmake_minimum_required(VERSION 3.15)
 
 set (Python3_FIND_VIRTUALENV STANDARD)
 find_package (Python3 REQUIRED)
diff --git a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
index 558fba3..89beb59 100644
--- a/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0037/RunCMakeTest.cmake
@@ -45,6 +45,10 @@
 run_cmake(WARN-cond-test)
 run_cmake(WARN-cond-package)
 
+run_cmake(alias-test-NEW)
+run_cmake(alias-test-OLD)
+run_cmake(alias-test-WARN)
+
 if(RunCMake_GENERATOR MATCHES "Make|Ninja")
   run_cmake(NEW-cond-package_source)
   run_cmake(OLD-cond-package_source)
diff --git a/Tests/RunCMake/CMP0037/alias-test-NEW-result.txt b/Tests/RunCMake/CMP0037/alias-test-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/CMP0037/alias-test-NEW-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-NEW-stderr.txt
new file mode 100644
index 0000000..68a36cc
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-NEW-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at alias-test-common\.cmake:[0-9]+ \(add_library\):
+  The target name "test" is reserved when CTest testing is enabled\.
+Call Stack \(most recent call first\):
+  alias-test-NEW\.cmake:[0-9]+ \(include\)
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0037/alias-test-NEW.cmake b/Tests/RunCMake/CMP0037/alias-test-NEW.cmake
new file mode 100644
index 0000000..32569b5
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-NEW.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0037 NEW)
+include(alias-test-common.cmake)
diff --git a/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt
new file mode 100644
index 0000000..bf177e2
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at alias-test-OLD\.cmake:[0-9]+ \(cmake_policy\):
+  The OLD behavior for policy CMP0037 will be removed from a future version
+  of CMake\.
+
+  The cmake-policies\(7\) manual explains that the OLD behaviors of all
+  policies are deprecated and that a policy should be set to OLD only under
+  specific short-term circumstances\.  Projects should be ported to the NEW
+  behavior and not rely on setting a policy to OLD\.
+Call Stack \(most recent call first\):
+  CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/CMP0037/alias-test-OLD.cmake b/Tests/RunCMake/CMP0037/alias-test-OLD.cmake
new file mode 100644
index 0000000..1f3e770
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-OLD.cmake
@@ -0,0 +1,2 @@
+cmake_policy(SET CMP0037 OLD)
+include(alias-test-common.cmake)
diff --git a/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt b/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt
new file mode 100644
index 0000000..43bf98b
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-WARN-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning \(dev\) at alias-test-common\.cmake:[0-9]+ \(add_library\):
+  Policy CMP0037 is not set: Target names should not be reserved and should
+  match a validity pattern\.  Run "cmake --help-policy CMP0037" for policy
+  details\.  Use the cmake_policy command to set the policy and suppress this
+  warning\.
+
+  The target name "test" is reserved when CTest testing is enabled\.  It may
+  result in undefined behavior\.
+Call Stack \(most recent call first\):
+  alias-test-WARN\.cmake:[0-9]+ \(include\)
+  CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/CMP0037/alias-test-WARN.cmake b/Tests/RunCMake/CMP0037/alias-test-WARN.cmake
new file mode 100644
index 0000000..688cb95
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-WARN.cmake
@@ -0,0 +1,2 @@
+# leave CMP0037 unset
+include(alias-test-common.cmake)
diff --git a/Tests/RunCMake/CMP0037/alias-test-common.cmake b/Tests/RunCMake/CMP0037/alias-test-common.cmake
new file mode 100644
index 0000000..f6e5000
--- /dev/null
+++ b/Tests/RunCMake/CMP0037/alias-test-common.cmake
@@ -0,0 +1,3 @@
+enable_testing()
+add_library(iface INTERFACE)
+add_library(test ALIAS iface)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index e7df911..76a68b4 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -753,7 +753,8 @@
   endif()
 endif()
 
-if(CMAKE_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])")
+if(CMAKE_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])"
+    AND NOT CMAKE_GENERATOR_TOOLSET MATCHES "^(v80|v90|v100|v110|v120)$")
   add_RunCMake_test(VsDotnetSdk)
   add_RunCMake_test(VsNugetPackageRestore)
 endif()
diff --git a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
index b8c6d75..11be360 100644
--- a/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/include_external_msproject/RunCMakeTest.cmake
@@ -11,7 +11,8 @@
   run_cmake(VSCSharpReference)
 endif()
 
-if(RunCMake_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])")
+if(RunCMake_GENERATOR MATCHES "^Visual Studio (1[6-9]|[2-9][0-9])"
+    AND NOT RunCMake_GENERATOR_TOOLSET MATCHES "^(v80|v90|v100|v110|v120)$")
   function(run_VSCSharpOnlyProject)
     set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/VSCSharpOnlyProject-build)
     run_cmake(VSCSharpOnlyProject)