https://build.opensuse.org/projects/openSUSE:Factory/packages/kst/files/kst-cmake4.patch

From 938ba7f91685c5d4261291f0b7ab5e986edc5a3e Mon Sep 17 00:00:00 2001
From: Christophe Marin <christophe@krop.fr>
Date: Tue, 1 Apr 2025 16:02:59 +0200
Subject: [PATCH] Fix build with CMake 4

---
 CMakeLists.txt | 41 ++++++++++++++++-------------------------
 1 file changed, 16 insertions(+), 25 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a4bc523..dce0253 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,19 @@
-cmake_minimum_required(VERSION 3.0.0)
+cmake_minimum_required(VERSION 3.16)
+
+set(kst_version_major 2)
+if(kst_version_string)
+    set(kst_version ${kst_version_string})
+    set(CPACK_PACKAGE_INSTALL_DIRECTORY "${kst_version}")
+else()
+    set(kst_version_minor 1)
+    #set(kst_version_patch x)
+    set(kst_version ${kst_version_major}.${kst_version_minor})
+    #set(kst_version ${kst_version_major}.${kst_version_minor}.${kst_version_patch})
+    set(kst_version_string ${kst_version})
+    set(CPACK_PACKAGE_INSTALL_DIRECTORY "Kst ${kst_version}")
+endif()
+
+project(Kst VERSION ${kst_version})
 
 if(kst_clang)
     set(CMAKE_C_COMPILER    "clang")
@@ -6,14 +21,6 @@ if(kst_clang)
     message(STATUS "Using clang  ${CMAKE_CXX_COMPILER}")
 endif()
 
-if(POLICY CMP0020)
-    cmake_policy(SET CMP0020 OLD)
-endif()
-
-if(${CMAKE_MAJOR_VERSION} EQUAL 3)
-    cmake_policy(SET CMP0043 OLD)
-endif()
-
 # figure out if we use MinGW with Ninja: call with -DCC=gcc
 if(WIN32 AND CMAKE_GENERATOR MATCHES Ninja AND CC MATCHES gcc)
     find_file(mingw_make mingw32-make.exe)
@@ -69,9 +76,6 @@ if(kst_cross)
 endif()
 
 
-project(Kst)
-
-
 if(kst_release)
     set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_WARNING_OUTPUT")
@@ -87,19 +91,6 @@ if(kst_sanitize)
 endif()
 
 
-set(kst_version_major 2)
-if(kst_version_string)
-    set(kst_version ${kst_version_string})
-    set(CPACK_PACKAGE_INSTALL_DIRECTORY "${kst_version}")
-else()
-    set(kst_version_minor 1)
-    #set(kst_version_patch x)
-    set(kst_version ${kst_version_major}.${kst_version_minor})
-    #set(kst_version ${kst_version_major}.${kst_version_minor}.${kst_version_patch})
-    set(kst_version_string ${kst_version})
-    set(CPACK_PACKAGE_INSTALL_DIRECTORY "Kst ${kst_version}")
-endif()
-
 if(CMAKE_COMPILER_IS_GNUCC)
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
     message(STATUS "Using GCC version ${GCC_VERSION}")
-- 
2.49.0
