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.
This commit is contained in:
Craig Scott
2025-10-26 18:09:50 +11:00
parent 57a0205c50
commit 2eceae155f
2 changed files with 2 additions and 3 deletions

View File

@@ -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)

View File

@@ -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 "")