CMake policies vs. minimum CMake version
CMake
policies
typically default to OLD
behavior compatible with prior versions of CMake.
cmake_minimum_required()
automatically sets all the CMake policies to “new” through the “maximum” CMake version, limited by the user’s CMake version.
Example: project with cmake_minimum_required(VERSION 3.14...3.20)
implicitly sets to NEW
all CMake policies CMP0120 and older for users with CMake ≥ 3.20.
A user with CMake 3.15 will get NEW for policies CMP0094 and older.
A user with CMake 3.13 will get an error due to the minimum version given as 3.14.
New versions of CMake don’t get the benefits of new behaviors until specifying the new behavior is OK via cmake_minimum_required()
maximum version number.
CMake gradually deprecates old policies, meaning the deprecated policies default to NEW
behavior.
For example, CMake 3.19
deprecated CMP0071
and older.