Skip to content

Commit 88ea2a1

Browse files
committed
Carry MBedTLS patch that works around CMake 3.18.2 bug. (#38933)
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. The latest minor release as of that merge was 2.25.0, so it's probably safe to conjecture that this patch will be live as of minor release 2.26.0; it's also possible that this patch will land on patch releases for 2.24.0 and 2.25.0, but this author doesn't know.
1 parent 264d855 commit 88ea2a1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

deps/mbedtls.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ $(SRCCACHE)/$(MBEDTLS_SRC)/source-extracted: $(SRCCACHE)/$(MBEDTLS_SRC).tar.gz
3131
checksum-mbedtls: $(SRCCACHE)/$(MBEDTLS_SRC).tar.gz
3232
$(JLCHECKSUM) $<
3333

34+
$(SRCCACHE)/$(MBEDTLS_SRC)/mbedtls-cmake-findpy.patch-applied: $(SRCCACHE)/$(MBEDTLS_SRC)/source-extracted
35+
# Apply workaround for CMake 3.18.2 bug (https://github.com/ARMmbed/mbedtls/pull/3691).
36+
# This patch merged upstream shortly after MBedTLS's 2.25.0 minor release, so chances
37+
# are it will be included at least in their next minor release (2.26.0?).
38+
cd $(SRCCACHE)/$(MBEDTLS_SRC) && \
39+
patch -p1 -f < $(SRCDIR)/patches/mbedtls-cmake-findpy.patch
40+
echo 1 > @$
41+
42+
$(BUILDDIR)/$(MBEDTLS_SRC)/build-configured: \
43+
$(SRCCACHE)/$(MBEDTLS_SRC)/mbedtls-cmake-findpy.patch-applied
44+
3445
$(BUILDDIR)/$(MBEDTLS_SRC)/build-configured: $(SRCCACHE)/$(MBEDTLS_SRC)/source-extracted
3546
mkdir -p $(dir $@)
3647
cd $(dir $@) && \
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2+
index 8833246..2ed55ed 100644
3+
--- a/CMakeLists.txt
4+
+++ b/CMakeLists.txt
5+
@@ -17,6 +17,18 @@
6+
#
7+
8+
cmake_minimum_required(VERSION 2.6)
9+
+
10+
+# https://cmake.org/cmake/help/latest/policy/CMP0011.html
11+
+# Setting this policy is required in CMake >= 3.18.0, otherwise a warning is generated. The OLD
12+
+# policy setting is deprecated, and will be removed in future versions.
13+
+cmake_policy(SET CMP0011 NEW)
14+
+# https://cmake.org/cmake/help/latest/policy/CMP0012.html
15+
+# Setting the CMP0012 policy to NEW is required for FindPython3 to work with CMake 3.18.2
16+
+# (there is a bug in this particular version), otherwise, setting the CMP0012 policy is required
17+
+# for CMake versions >= 3.18.3 otherwise a deprecated warning is generated. The OLD policy setting
18+
+# is deprecated and will be removed in future versions.
19+
+cmake_policy(SET CMP0012 NEW)
20+
+
21+
if(TEST_CPP)
22+
project("mbed TLS" C CXX)
23+
else()

0 commit comments

Comments
 (0)