Deduce cmake_minimum_required from the features I use

Throughout the documentation, the minimum required CMake version is given. When I create or modify a CMake script, I often forget about the minimum version requirement. Is there a static analysis tool that checks the CMake code and warns if the cmake_minimum_required version declared is not recent enough for the features I use? And conversely, if the required version in cmake_minimum_required is unnecessarily recent?

No, there is no such support. Note that options and inline CMAKE_VERSION detection can make such things difficult to give hard answers on.

If you care about your minimum CMake version declaration being accurate, test it with that version of CMake.