summarylogtreecommitdiffstats
path: root/use-system-mbedtls.patch
blob: 64a8b5278d4e59d4de559bf54f33a30ee533a766 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
--- CMakeLists.txt	2016-06-04 22:18:20.000000000 -0400
+++ CMakeLists1.txt	2020-02-02 13:58:37.898519666 -0500
@@ -373,11 +373,18 @@
 ENDIF(AUDIO_CAPTCHA)
 
 IF(FROST_SUPPORT OR FCP_SSL_SUPPORT)
-	ADD_SUBDIRECTORY(libs/mbedtls)
-	TARGET_LINK_LIBRARIES(fms mbedtls)
-	TARGET_LINK_LIBRARIES(fms mbedcrypto)
-	TARGET_LINK_LIBRARIES(fms mbedx509)
-	INCLUDE_DIRECTORIES(libs/mbedtls/include)
+	MESSAGE(STATUS "Linking against system MbedTLS library.")
+	FIND_LIBRARY(MBEDTLS_LIBRARY NAMES mbedtls )
+	FIND_LIBRARY(MBEDCRYPTO_LIBRARY NAMES mbedcrypto mbedx509)
+	FIND_LIBRARY(MBEDX509_LIBRARY NAMES mbedx509)
+
+	IF(MBEDTLS_LIBRARY)
+		TARGET_LINK_LIBRARIES(fms ${MBEDTLS_LIBRARY})
+		TARGET_LINK_LIBRARIES(fms ${MBEDCRYPTO_LIBRARY})
+		TARGET_LINK_LIBRARIES(fms ${MBEDX509_LIBRARY})
+	ELSE(MBEDTLS_LIBRARY)
+		MESSAGE(FATAL ERROR: "Could not find mbedtls library.")
+	ENDIF(MBEDTLS_LIBRARY)
 
 	IF(FROST_SUPPORT)
 		ADD_DEFINITIONS(-DFROST_SUPPORT)