From 04fafd55252072ba148b87f20d8509ff1a91086e Mon Sep 17 00:00:00 2001 From: LibretroAdmin Date: Sat, 22 Aug 2026 23:30:35 +0000 Subject: [PATCH] Raise policy version floor so CMake 4.x can configure the tree CMake 4.0 removed support for policy versions below 3.5, which makes configuration abort on the pinned fmt and enet submodules before any source is compiled. Setting CMAKE_POLICY_VERSION_MINIMUM in the top level project keeps those subdirectories configurable across every target without each build recipe having to supply the flag itself, while still deferring to a value given on the command line. --- CMakeLists.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7b18eb1..c32e3459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,17 @@ # CMake 3.8 required for 17 to be a valid value for CXX_STANDARD cmake_minimum_required(VERSION 3.8) + +# CMake 4.0 dropped compatibility with cmake_minimum_required(VERSION < 3.5). +# Bundled externals pinned as submodules (fmt declares 3.1.0, enet declares 2.6) +# still request pre-3.5 policy versions and cannot be bumped from this tree, so +# raise the floor for the whole build instead of requiring every consumer to +# pass -DCMAKE_POLICY_VERSION_MINIMUM on the command line. A value supplied on +# the command line or in the cache continues to take precedence, and CMake +# older than 3.31 ignores the variable. +if (NOT DEFINED CMAKE_POLICY_VERSION_MINIMUM) + set(CMAKE_POLICY_VERSION_MINIMUM 3.5) +endif() + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules") list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules") include(CMakeDependentOption)