From 02d943ddc41ed90a5c30108518667b1c5eb81a6e Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Fri, 14 Aug 2026 20:46:49 -0400 Subject: [PATCH] COMP: Guard the CMP0169 policy setting so older CMake still configures CMakeLists.txt sets policy CMP0169 unconditionally, to keep using the deprecated FetchContent_Populate. CMP0169 was introduced in CMake 3.30, and cmake_policy(SET) on an unknown policy is a hard error, so any CMake older than that fails to configure at all: CMake Error at CMakeLists.txt:175 (cmake_policy): Policy "CMP0169" is not known to this version of CMake. That includes the CMake 3.28 shipped by Ubuntu 24.04, which is what the CI runners and the project's own Dockerfile use, and it sits well above the cmake_minimum_required(VERSION 3.10.2) the project advertises. Wrapping it in if(POLICY CMP0169) is the standard idiom. Verified configuring with both CMake 3.28.3 and 4.4.2. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01KSPnbwpDjVcAYqDdVqLkMU --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04b106ce..fd551f15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,7 +163,12 @@ if (NIFTI_BUILD_TESTING ) include(FetchContent) # fetch data a configure time to simplify tests # If new or changed data is needed, add that data to the https://github.com/NIFTI-Imaging/nifti-test-data repo # make a new release, and then update the URL and hash (shasum -a 256 ). - cmake_policy(SET CMP0169 OLD) + # CMP0169 (deprecating FetchContent_Populate) only exists from CMake 3.30; + # setting it unconditionally is a hard error on every earlier release, + # including the CMake 3.28 that Ubuntu 24.04 ships. + if(POLICY CMP0169) + cmake_policy(SET CMP0169 OLD) + endif() FetchContent_Declare( fetch_testing_data URL https://github.com/NIFTI-Imaging/nifti-test-data/archive/v3.0.2.tar.gz URL_HASH SHA256=5dafec078151018da7aaf3c941bd31f246f590bc34fa3fef29ce77a773db16a6