From de68f4d02946d588af6a0c21cf966288c40b039f Mon Sep 17 00:00:00 2001
From: Markus Volk <f_l_k@t-online.de>
Date: Thu, 10 Jul 2025 09:04:27 +0200
Subject: [PATCH] x265: fix build with cmake 4

drop policies that have been removed in cmake 4 and allow to build
with 4.0

Signed-off-by: Markus Volk <f_l_k@t-online.de>

Upstream-Status: Submitted [https://github.com/videolan/x265/pull/17]
---
 source/CMakeLists.txt              | 8 +-------
 source/dynamicHDR10/CMakeLists.txt | 4 ++--
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c6dda9e8..bd9e0f8d9 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,18 +6,12 @@ if(NOT CMAKE_BUILD_TYPE)
         FORCE)
 endif()
 message(STATUS "cmake version ${CMAKE_VERSION}")
-if(POLICY CMP0025)
-    cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
-endif()
 if(POLICY CMP0042)
     cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
 endif()
-if(POLICY CMP0054)
-    cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted
-endif()
 
 project (x265)
-cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
+cmake_minimum_required (VERSION 2.8.8...4.0) # OBJECT libraries require 2.8.8
 include(CheckIncludeFiles)
 include(CheckFunctionExists)
 include(CheckSymbolExists)
diff --git a/dynamicHDR10/CMakeLists.txt b/dynamicHDR10/CMakeLists.txt
index 22fb79d44..03c866b1f 100644
--- a/dynamicHDR10/CMakeLists.txt
+++ b/dynamicHDR10/CMakeLists.txt
@@ -10,7 +10,7 @@ add_library(dynamicHDR10 OBJECT
     hdr10plus.h
     api.cpp )
 
-cmake_minimum_required (VERSION 2.8.11)
+cmake_minimum_required (VERSION 2.8.11...4.0)
 project(dynamicHDR10)
 include(CheckIncludeFiles)
 include(CheckFunctionExists)
@@ -150,4 +150,4 @@ set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
 option(ENABLE_SHARED "Build shared library" OFF)
 
 install(FILES hdr10plus.h DESTINATION include)
-endif()
\ No newline at end of file
+endif()
-- 
2.49.0

