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 <noreply@anthropic.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user