Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

cmake/ggml_tq_overlay_test.cmake sets CMP0057 NEW so IN_LIST works under CMake 3.x (#3412)

Niko1221590c69a57870
diff --git a/cmake/ggml_tq_overlay_test.cmake b/cmake/ggml_tq_overlay_test.cmake
index e56604c81..ca637e5f4 100644
--- a/cmake/ggml_tq_overlay_test.cmake
+++ b/cmake/ggml_tq_overlay_test.cmake
@@ -1,6 +1,8 @@
# cmake -DLLAMA=<llama.cpp dir> -DOUT=<scratch dir> -P cmake/ggml_tq_overlay_test.cmake
# The trellis MMQ overlay on a pinned llama.cpp: it generates, every copied header is the pinned one except the patched
# ones, and the patched ones only gain lines (TQ routing, three externs, config copies of IQ2_XS's).
+# a -P script has no cmake_minimum_required, so CMake 3.x applies the OLD CMP0057 and IN_LIST below is not an operator (#3412)
+cmake_policy(SET CMP0057 NEW)
get_filename_component(CMAKE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/.." ABSOLUTE)
include(${CMAKE_CURRENT_LIST_DIR}/strata_ggml_tq_overlay.cmake)
file(REMOVE_RECURSE "${OUT}")
diff --git a/tests/terminal/test_cmake_script_policies.py b/tests/terminal/test_cmake_script_policies.py
new file mode 100644
index 000000000..cad4e98da
--- /dev/null
+++ b/tests/terminal/test_cmake_script_policies.py
@@ -0,0 +1,29 @@
+"""A `cmake -P` script has no cmake_minimum_required, so CMake 3.x applies the OLD behaviour of CMP0057 and `IN_LIST` is not an operator
+(ctest ggml_tq_overlay stopped at its first IN_LIST with CMake 3.31, #3412). Every script in cmake/ that is run with -P and uses IN_LIST
+sets the policy before the first use. (Static check: the project accepts CMake 3.24 and newer, and CMake 4 sets the policy by itself.)"""
+from __future__ import annotations
+
+import re
+import unittest
+from pathlib import Path
+
+CMAKE = Path(__file__).resolve().parents[2] / "cmake"
+
+
+class ScriptPolicies(unittest.TestCase):
+ def test_p_scripts_that_use_in_list_set_cmp0057_first(self):
+ found = 0
+ for path in sorted(CMAKE.glob("*_test.cmake")):
+ text = path.read_text(encoding="utf-8")
+ code = re.sub(r"(?m)^\s*#.*$", "", text)
+ if "IN_LIST" not in code:
+ continue
+ found += 1
+ policy = re.search(r"cmake_policy\(\s*SET\s+CMP0057\s+NEW\s*\)", code) or re.search(r"cmake_minimum_required\(\s*VERSION\s+3\.(1[0-9]|[2-9]\d)", code)
+ self.assertTrue(policy, f"{path.name} uses IN_LIST without CMP0057 NEW")
+ self.assertLess(policy.start(), code.index("IN_LIST"), f"{path.name} sets the policy after its first IN_LIST")
+ self.assertGreaterEqual(found, 1)
+
+
+if __name__ == "__main__":
+ unittest.main()