From 2eceae155fb610cc4a451df547d67e02f44b954c Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sun, 26 Oct 2025 18:09:50 +1100 Subject: [PATCH] GoogleTest: Update policies to CMake 4.2 In fc7aa3cd69 (tests: Preserve empty arguments in test command lines, 2024-09-30), the CMP0174 policy setting had to be explicitly handled in GoogleTestAddTests.cmake because it was part of the same release. Now that we're past that release, we can remove that and update the policies based on the CMake version instead. This removes the TODO added in that original commit. We also update the policy settings in GoogleTest.cmake so that we are using consistent policy settings across the GoogleTest implementation. --- Modules/GoogleTest.cmake | 2 +- Modules/GoogleTestAddTests.cmake | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Modules/GoogleTest.cmake b/Modules/GoogleTest.cmake index 2fded3f2f7..5f4eaf84e9 100644 --- a/Modules/GoogleTest.cmake +++ b/Modules/GoogleTest.cmake @@ -332,7 +332,7 @@ same as the Google Test name (i.e. ``suite.testcase``); see also # Save project's policies block(SCOPE_FOR POLICIES) -cmake_policy(VERSION 3.30) +cmake_policy(VERSION 4.2) #------------------------------------------------------------------------------ function(gtest_add_tests) diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 1ef3d6d546..957d7b4f93 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -1,8 +1,7 @@ # Distributed under the OSI-approved BSD 3-Clause License. See accompanying # file LICENSE.rst or https://cmake.org/licensing for details. -cmake_minimum_required(VERSION 3.30) -cmake_policy(SET CMP0174 NEW) # TODO: Remove this when we can update the above to 3.31 +cmake_minimum_required(VERSION 4.2) function(add_command name test_name) set(args "")