aboutsummaryrefslogtreecommitdiff
path: root/BuildMbedtls.cmake
diff options
context:
space:
mode:
authorQixiang Xu <qixiang.xu@arm.com>2019-02-21 17:08:50 +0800
committerGy├Ârgy Szing <gyorgy.szing@arm.com>2019-03-21 12:32:13 +0000
commita0f505c659e2af2ffa278d215045add711f7f2d8 (patch)
tree82e84beca0bc4f9f13ebf6215a6aafe6c55cdff6 /BuildMbedtls.cmake
parent35f8939592898b3bedbf0d09259ad5c9ca925b59 (diff)
downloadtrusted-firmware-m-a0f505c659e2af2ffa278d215045add711f7f2d8.tar.gz
Build: Fixed compile error for the mbedtls-2.7.9 on Cygwin platform
When building Mbed TLS > 2.7 on Cygwin as part of the TF-M build, related to a failure in the creation of a symbolic link. Changes the build system to build Mbed TLS with CMAKE_HOST_UNIX = true. More see Mbed TLS issue https://github.com/ARMmbed/mbedtls/issues/1496 Change-Id: I92c25fca7220e2b279e1c07b6c3f29f4161546e2 Co-Authored-By: Gyorgy Szing <Gyorgy.Szing@arm.com> Signed-off-by: Qixiang Xu <qixiang.xu@arm.com>
Diffstat (limited to 'BuildMbedtls.cmake')
-rw-r--r--BuildMbedtls.cmake15
1 files changed, 14 insertions, 1 deletions
diff --git a/BuildMbedtls.cmake b/BuildMbedtls.cmake
index 1807d804c..afb5307c7 100644
--- a/BuildMbedtls.cmake
+++ b/BuildMbedtls.cmake
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -47,6 +47,15 @@ else()
string(APPEND MBEDTLS_C_FLAGS ${MBEDTLS_PREINCLUDE_C_FLAGS})
endif()
+function(get_mbedtls_version)
+ file(READ "${MBEDTLS_SOURCE_DIR}/include/mbedtls/version.h" MBEDTLS_VER_FILE)
+ string(REGEX REPLACE ".*#define[ ]+MBEDTLS_VERSION_STRING[^\"]+\"+([0-9.]+)\".*" "\\1"
+ _MBEDTLS_VER ${MBEDTLS_VER_FILE})
+ set(MBEDTLS_VERSION ${_MBEDTLS_VER} PARENT_SCOPE)
+endfunction()
+
+get_mbedtls_version()
+
string(APPEND MBEDTLS_C_FLAGS ${CMAKE_C_FLAGS})
# Workaround Mbed TLS issue https://github.com/ARMmbed/mbedtls/issues/1077
@@ -71,6 +80,10 @@ externalproject_add(${MBEDTLS_TARGET_NAME}
CMAKE_ARGS -DENABLE_TESTING=OFF -DENABLE_PROGRAMS=OFF
#Enforce our build system's settings.
CMAKE_ARGS -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}
+ #Workaround for MbedTLS issue https://github.com/ARMmbed/mbedtls/issues/1496
+ if(MBEDTLS_VERSION VERSION_GREATER "2.7.0")
+ CMAKE_ARGS -DCMAKE_HOST_UNIX:bool=true
+ endif()
#Inherit the build setting of this project
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${MBEDTLS_BUILD_TYPE}
#C compiler settings