1From 9efbf7f9baa846867a9c5586e4cc82a8a19e2e84 Mon Sep 17 00:00:00 2001
2From: Emily <hello@emily.moe>
3Date: Wed, 17 Sep 2025 19:00:01 +0100
4Subject: [PATCH 1/2] tests: fix `test_issue335_support_cmake_source_dir` with
5 CMake 4
6
7---
8 tests/samples/issue-335-support-cmake-source-dir/CMakeLists.txt | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11diff --git a/tests/samples/issue-335-support-cmake-source-dir/CMakeLists.txt b/tests/samples/issue-335-support-cmake-source-dir/CMakeLists.txt
12index 7e391c46..18bae2bf 100644
13--- a/tests/samples/issue-335-support-cmake-source-dir/CMakeLists.txt
14+++ b/tests/samples/issue-335-support-cmake-source-dir/CMakeLists.txt
15@@ -1,4 +1,4 @@
16-cmake_minimum_required(VERSION 3.2)
17+cmake_minimum_required(VERSION 3.2...3.10)
18
19 project(hello NONE)
20
21
22From 491d7494a3ec6cc181d37d02670c65b74c67cbfe Mon Sep 17 00:00:00 2001
23From: Emily <hello@emily.moe>
24Date: Wed, 17 Sep 2025 19:00:01 +0100
25Subject: [PATCH 2/2] tests: fix `test_make_without_configure_fails` with CMake
26 4
27
28---
29 tests/test_cmaker.py | 5 ++++-
30 1 file changed, 4 insertions(+), 1 deletion(-)
31
32diff --git a/tests/test_cmaker.py b/tests/test_cmaker.py
33index cf166905..9b6c3758 100644
34--- a/tests/test_cmaker.py
35+++ b/tests/test_cmaker.py
36@@ -82,7 +82,10 @@ def test_make_without_configure_fails(capfd):
37 CMaker().make()
38 _, err = capfd.readouterr()
39 assert "An error occurred while building with CMake." in str(excinfo.value)
40- assert "Error: could not load cache" in err
41+ # CMake 4 changed the error message.
42+ err_message_cmake_3 = "Error: could not load cache"
43+ err_message_cmake_4 = "Error: not a CMake build directory (missing CMakeCache.txt)"
44+ assert err_message_cmake_3 in err or err_message_cmake_4 in err
45
46
47 @pytest.mark.parametrize("configure_with_cmake_source_dir", [True, False])