From 3c6439530dedaeec60fc09a4a43eaf01e5040f22 Mon Sep 17 00:00:00 2001 From: leonarski_f Date: Fri, 19 Jun 2026 20:03:18 +0200 Subject: [PATCH] cmake: raise policy floor to 3.5 for FetchContent deps (CMake 4.x) CMake >= 4.0 (4.3.1 ships bundled with Visual Studio 2026) makes any cmake_minimum_required(VERSION < 3.5) a fatal error. The fetched libzmq still declares VERSION 3.0.2, which aborts configuration before our own CMakeLists gets a say. Set CMAKE_POLICY_VERSION_MINIMUM=3.5 before the FetchContent_MakeAvailable calls so those subprojects configure; the variable is simply unused (harmless) on CMake < 3.30. Verified against CMake 4.3.1: the real libzmq source fails without it and configures with it, and an in-file SET() propagates into the add_subdirectory child exactly as a -D cache entry does. Co-Authored-By: Claude Opus 4.8 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index be6e490c..d90e1341 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -156,6 +156,12 @@ FetchContent_Declare( EXCLUDE_FROM_ALL ) +# CMake >= 4.0 (e.g. the 4.x bundled with Visual Studio 2026) makes any +# cmake_minimum_required(VERSION < 3.5) a fatal error. Some fetched dependencies still +# declare such old floors (libzmq: 3.0.2), so raise the policy-version floor for the +# FetchContent subprojects. Ignored (harmless) on CMake < 3.30, which lacks this variable. +SET(CMAKE_POLICY_VERSION_MINIMUM 3.5) + # libzmq must be made available BEFORE sls_detector_package for the override above to take effect. FetchContent_MakeAvailable(libzmq) FetchContent_MakeAvailable(zstd sls_detector_package catch2 hdf5 spdlog httplib)