cpputest: Backport patches to support builds with CMake 4+

There hasn't been a new upstream release yet that ships the required changes.

Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Moritz Haase 2025-07-11 12:00:20 +02:00 committed by Khem Raj
parent 26c61dfccd
commit 4efbdb2d27
No known key found for this signature in database
GPG Key ID: BB053355919D3314
3 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 5351875cde23340c0a98fe46566cde5535c40e21 Mon Sep 17 00:00:00 2001
From: georgev93 <georgeavogt93@gmail.com>
Date: Fri, 26 Jun 2020 19:07:14 -0400
Subject: [PATCH 1/2] Call cmake_minimum_required() before project() in
CMakeLists.txt.
From https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html:
Note: Call the cmake_minimum_required() command at the beginning of the top-level CMakeLists.txt file even before calling the project() command. It is important to establish version and policy settings before invoking other commands whose behavior they may affect. See also policy CMP0000.
Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
Upstream-Status: Backport [e0c050d8b614294b2215a62e64628470fab67f20]
---
CMakeLists.txt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 88e0cfb5..d36c6491 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,12 +1,12 @@
+# 2.6.3 is needed for ctest support
+# 3.1 is needed for target_sources
+cmake_minimum_required(VERSION 3.1)
+
project(CppUTest)
set(CppUTest_version_major 4)
set(CppUTest_version_minor 0)
-# 2.6.3 is needed for ctest support
-# 3.1 is needed for target_sources
-cmake_minimum_required(VERSION 3.1)
-
###############
# Conan support
###############

View File

@ -0,0 +1,43 @@
From 46bdc8ceca42fd19cd2b97d9fa845860e537dee9 Mon Sep 17 00:00:00 2001
From: Chad Condon <chad@condon.tech>
Date: Fri, 27 Dec 2024 18:21:21 -0800
Subject: [PATCH 2/2] Squelch deprecation warning
Most recent CMake started complaining about the pending end of 3.8
support.
> ```
> CMake Deprecation Warning at CMakeLists.txt:4 (cmake_minimum_required):
> Compatibility with CMake < 3.10 will be removed from a future version of
> CMake.
>
> Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
> to tell CMake that the project requires at least <min> but has been updated
> to work with policies introduced by <max> or earlier.
> ```
We can retain support by adding a max version. This will no
prevent use with newer versions, but indicates forward
compatibility.[^1]
[^1]: https://cmake.org/cmake/help/latest/command/cmake_minimum_required.html
Signed-off-by: Moritz Haase <Moritz.Haase@bmw.de>
Upstream-Status: Backport [9dda473ded5913d47221e7ae50817dbcd45175ff]
---
CMakeLists.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d36c6491..0cc12cb1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,7 @@
# 2.6.3 is needed for ctest support
# 3.1 is needed for target_sources
-cmake_minimum_required(VERSION 3.1)
+# 3.8 is needed for try_compile improvements (CMP0067)
+cmake_minimum_required(VERSION 3.8...3.31)
project(CppUTest)

View File

@ -5,7 +5,10 @@ SECTION = "devel"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=ce5d5f1fe02bcd1343ced64a06fd4177"
SRC_URI = "git://github.com/cpputest/cpputest.git;protocol=https;branch=master"
SRC_URI = "git://github.com/cpputest/cpputest.git;protocol=https;branch=master \
file://0001-Call-cmake_minimum_required-before-project-in-CMakeL.patch \
file://0002-Squelch-deprecation-warning.patch \
"
SRCREV = "67d2dfd41e13f09ff218aa08e2d35f1c32f032a1"