From 2dcb8c7b2f784301a4500ede9936d8090a1817f6 Mon Sep 17 00:00:00 2001 From: icc Date: Fri, 22 May 2026 21:49:23 +0800 Subject: [PATCH] fix: set CMP0207 for runtime dependency scan --- tests/test_install_deps_policy.py | 17 +++++++++++++++++ .../install-deps.cmake.in | 4 ++++ 2 files changed, 21 insertions(+) create mode 100644 tests/test_install_deps_policy.py diff --git a/tests/test_install_deps_policy.py b/tests/test_install_deps_policy.py new file mode 100644 index 0000000..b5b658e --- /dev/null +++ b/tests/test_install_deps_policy.py @@ -0,0 +1,17 @@ +from pathlib import Path + + +def test_install_deps_sets_cmp0207_before_runtime_dependency_scan( + top_level_dir: Path, +): + template = ( + top_level_dir + / "vtk_sdk_python_wheel_helper" + / "install-deps.cmake.in" + ).read_text(encoding="utf-8") + + policy_position = template.index("cmake_policy(SET CMP0207 NEW)") + runtime_deps_position = template.index("file(GET_RUNTIME_DEPENDENCIES") + + assert "if(POLICY CMP0207)" in template + assert policy_position < runtime_deps_position diff --git a/vtk_sdk_python_wheel_helper/install-deps.cmake.in b/vtk_sdk_python_wheel_helper/install-deps.cmake.in index f532b2e..db74ff5 100644 --- a/vtk_sdk_python_wheel_helper/install-deps.cmake.in +++ b/vtk_sdk_python_wheel_helper/install-deps.cmake.in @@ -1,3 +1,7 @@ +if(POLICY CMP0207) + cmake_policy(SET CMP0207 NEW) +endif() + file(GET_RUNTIME_DEPENDENCIES RESOLVED_DEPENDENCIES_VAR resolved_deps UNRESOLVED_DEPENDENCIES_VAR unresolved_deps