CMAKE_POLICY_VERSION_MINIMUM policy initialization across CMake 3.24 and later
0 reputation · 25 Mar 2023, 09:17 UTC
CMAKE_POLICY_VERSION_MINIMUM policy initialization across CMake 3.24 and later
A project sets CMAKE_POLICY_VERSION_MINIMUM before cmake_minimum_required(VERSION 3.10) under CMake 3.24 or later. The goal is to determine whether every policy introduced after 3.10 and before the running CMake release initializes to OLD, or whether only policies explicitly marked in that interval are affected.
CMake 3.24 added the variable to declare minimum policy behavior independently from the project version, but it does not state whether the guarantee covers all intermediate policies or only those with documented introduction versions in that range. Policy defaults can change between feature releases, so identical CMakeLists.txt files may initialize policies differently on CMake 3.24 versus 3.30. Confirming the effective state requires checking each policy's introduction version against the running release.
Does CMAKE_POLICY_VERSION_MINIMUM force OLD semantics for every policy added after the declared minimum up to the running CMake version? Which policies introduced between the declared minimum and the running release remain at their default state? How can a project confirm the effective initialization for a specific policy before target creation?