ExternalProject: Enable all policies in internal scripts
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index bef918d..3f43542 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1757,7 +1757,7 @@
     set(stderr_log "${logbase}-err.log")
   endif()
   set(code "
-cmake_minimum_required(VERSION 3.15)
+cmake_minimum_required(VERSION \${CMAKE_VERSION}) # this file comes with cmake
 ${code_cygpath_make}
 set(command \"${command}\")
 set(log_merged \"${log_merged}\")
diff --git a/Modules/ExternalProject/download.cmake.in b/Modules/ExternalProject/download.cmake.in
index 77d43d7..5e8c42f 100644
--- a/Modules/ExternalProject/download.cmake.in
+++ b/Modules/ExternalProject/download.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 function(check_file_hash has_hash hash_is_good)
   if("${has_hash}" STREQUAL "")
diff --git a/Modules/ExternalProject/extractfile.cmake.in b/Modules/ExternalProject/extractfile.cmake.in
index 39daaff..a601bd7 100644
--- a/Modules/ExternalProject/extractfile.cmake.in
+++ b/Modules/ExternalProject/extractfile.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 # Make file names absolute:
 #
diff --git a/Modules/ExternalProject/gitclone.cmake.in b/Modules/ExternalProject/gitclone.cmake.in
index b80bcb1..77d6be2 100644
--- a/Modules/ExternalProject/gitclone.cmake.in
+++ b/Modules/ExternalProject/gitclone.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 if(EXISTS "@gitclone_stampfile@" AND EXISTS "@gitclone_infofile@" AND
   "@gitclone_stampfile@" IS_NEWER_THAN "@gitclone_infofile@")
diff --git a/Modules/ExternalProject/gitupdate.cmake.in b/Modules/ExternalProject/gitupdate.cmake.in
index fb0c6a6..8a214df 100644
--- a/Modules/ExternalProject/gitupdate.cmake.in
+++ b/Modules/ExternalProject/gitupdate.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 # Even at VERBOSE level, we don't want to see the commands executed, but
 # enabling them to be shown for DEBUG may be useful to help diagnose problems.
diff --git a/Modules/ExternalProject/hgclone.cmake.in b/Modules/ExternalProject/hgclone.cmake.in
index 96449aa..5d5e8ca 100644
--- a/Modules/ExternalProject/hgclone.cmake.in
+++ b/Modules/ExternalProject/hgclone.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 if(EXISTS "@hgclone_stampfile@" AND EXISTS "@hgclone_infofile@" AND
   "@hgclone_stampfile@" IS_NEWER_THAN "@hgclone_infofile@")
diff --git a/Modules/ExternalProject/mkdirs.cmake.in b/Modules/ExternalProject/mkdirs.cmake.in
index 03676a2..6d2ed28 100644
--- a/Modules/ExternalProject/mkdirs.cmake.in
+++ b/Modules/ExternalProject/mkdirs.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 # If CMAKE_DISABLE_SOURCE_CHANGES is set to true and the source directory is an
 # existing directory in our source tree, calling file(MAKE_DIRECTORY) on it
diff --git a/Modules/ExternalProject/stepscript.cmake.in b/Modules/ExternalProject/stepscript.cmake.in
index 12e157e..ba832c3 100644
--- a/Modules/ExternalProject/stepscript.cmake.in
+++ b/Modules/ExternalProject/stepscript.cmake.in
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.29)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 message(VERBOSE "Executing @step_name@ step for @name@")
 
diff --git a/Modules/ExternalProject/verify.cmake.in b/Modules/ExternalProject/verify.cmake.in
index 30d0487..3cf768f 100644
--- a/Modules/ExternalProject/verify.cmake.in
+++ b/Modules/ExternalProject/verify.cmake.in
@@ -1,7 +1,7 @@
 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
 # file Copyright.txt or https://cmake.org/licensing for details.
 
-cmake_minimum_required(VERSION 3.5)
+cmake_minimum_required(VERSION ${CMAKE_VERSION}) # this file comes with cmake
 
 if("@LOCAL@" STREQUAL "")
   message(FATAL_ERROR "LOCAL can't be empty")