Skip to content

Commit b76c235

Browse files
committed
Carry MBedTLS patch that works around CMake 3.18.2 bug.
MBedTLS fails to build with CMake 3.18.2, due to a bug in CMake 3.18.2 causing failure to find python3. For more information, please see Mbed-TLS/mbedtls#3690 and https://gitlab.kitware.com/cmake/cmake/-/issues/21204. This pull request applies the MBedTLS patch that works around this issue from Mbed-TLS/mbedtls#3691, which has been merged into MBedTLS's development branch but not yet into a tagged release.
1 parent 996dd55 commit b76c235

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

deps/mbedtls.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ $(SRCCACHE)/$(MBEDTLS_SRC)/source-extracted: $(SRCCACHE)/$(MBEDTLS_SRC).tar.gz
2323
$(JLCHECKSUM) $<
2424
mkdir -p $(dir $@) && \
2525
$(TAR) -C $(dir $@) --strip-components 1 -xf $<
26+
# Apply workaround for CMake 3.18.2 bug (https://github.com/ARMmbed/mbedtls/pull/3691).
27+
cd $(SRCCACHE)/$(MBEDTLS_SRC) && patch -p1 -f < $(SRCDIR)/patches/mbedtls-cmake-findpy.patch
2628
# Force-enable MD4
2729
sed "s|//#define MBEDTLS_MD4_C|#define MBEDTLS_MD4_C|" -i $(SRCCACHE)/$(MBEDTLS_SRC)/include/mbedtls/config.h
2830
touch -c $(SRCCACHE)/$(MBEDTLS_SRC)/CMakeLists.txt # old target
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
From b250ac951dfd77ad7a128180fc8514ef5151cb5c Mon Sep 17 00:00:00 2001
2+
From: Paul Elliott <[email protected]>
3+
Date: Fri, 18 Sep 2020 18:15:07 +0100
4+
Subject: [PATCH] Set CMake policies for newer versions of CMake
5+
6+
Make sure that CMP0012 is set to NEW, without which FindPython3 and
7+
FindPython2 functionality becomes broken with CMake 3.18.2 if searching
8+
by location. CMP0012 being set to OLD is also deprecated as of 3.18.3.
9+
Ensure CMP0011 is set to NEW to avoid warnings and deprecated behaviour
10+
being issued about policy push / pop with CMake 3.18.0 or newer.
11+
12+
Signed-off-by: Paul Elliott <[email protected]>
13+
---
14+
CMakeLists.txt | 12 ++++++++++++
15+
1 file changed, 12 insertions(+)
16+
17+
diff --git a/CMakeLists.txt b/CMakeLists.txt
18+
index ac24bf41b4c..fdaa2f134d6 100644
19+
--- a/CMakeLists.txt
20+
+++ b/CMakeLists.txt
21+
@@ -21,6 +21,18 @@
22+
#
23+
24+
cmake_minimum_required(VERSION 2.8.12)
25+
+
26+
+# https://cmake.org/cmake/help/latest/policy/CMP0011.html
27+
+# Setting this policy is required in CMake >= 3.18.0, otherwise a warning is generated. The OLD
28+
+# policy setting is deprecated, and will be removed in future versions.
29+
+cmake_policy(SET CMP0011 NEW)
30+
+# https://cmake.org/cmake/help/latest/policy/CMP0012.html
31+
+# Setting the CMP0012 policy to NEW is required for FindPython3 to work with CMake 3.18.2
32+
+# (there is a bug in this particular version), otherwise, setting the CMP0012 policy is required
33+
+# for CMake versions >= 3.18.3 otherwise a deprecated warning is generated. The OLD policy setting
34+
+# is deprecated and will be removed in future versions.
35+
+cmake_policy(SET CMP0012 NEW)
36+
+
37+
if(TEST_CPP)
38+
project("mbed TLS" C CXX)
39+
else()
40+

0 commit comments

Comments
 (0)