Backport upstream patch fixing support for CMake >= 4.0 version. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>