The cmake-4.0 dropped policies older than 3.5, so in order to support cmake-4.0 either the cmake_minimum_required needs to be bumped to 3.5:
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
or interval needs to be added, e.g.:
cmake_minimum_required(VERSION 3.1...4.0 FATAL_ERROR)