Просмотр исходного кода

FetchContent: Update policy settings to CMake 4.1

The warning for policy CMP0174 can be triggered if a project mistakenly
specifies CONFIGURE_COMMAND, BUILD_COMMAND, INSTALL_COMMAND,
or TEST_COMMAND as keywords to FetchContent_Declare() and it passes
an empty string after the keyword. It shouldn't be specifying any of those
keywords, but doing so has always worked because FetchContent_Declare()
explicitly discards them. However, when a project specifies them, they get
used internally in contexts where the policy settings are those of the
FetchContent module itself. Those settings haven't been updated past
CMake 3.29, and CMP0174 came in with CMake 3.31.

Update the policy settings for FetchContent to avoid triggering the CMP0174
warning when a project erroneously specifies the prohibited keywords.

Fixes: #27157
Craig Scott 2 месяцев назад
Родитель
Сommit
20c751bdcb

+ 1 - 1
Modules/ExternalProject/shared_internal_commands.cmake

@@ -1,4 +1,4 @@
-cmake_policy(VERSION 3.25)
+cmake_policy(VERSION 4.1)
 
 # Determine the remote URL of the project containing the working_directory.
 # This will leave output_variable unset if the URL can't be determined.

+ 1 - 1
Modules/FetchContent.cmake

@@ -1138,7 +1138,7 @@ current working directory.
 # FetchContent_MakeAvailable() implementation details are excluded for
 # backward compatibility reasons (see just after the endblock()).
 block(SCOPE_FOR POLICIES)
-cmake_policy(VERSION 3.29)
+cmake_policy(VERSION 4.1)
 
 include(${CMAKE_CURRENT_LIST_DIR}/ExternalProject/shared_internal_commands.cmake)