@@ -6,6 +6,8 @@ include(SanitizeBool)
66sanitizebool(USE_SHA1)
77sanitizebool(USE_SHA256)
88
9+ # sha1
10+
911if (USE_SHA1 STREQUAL ON )
1012 SET (USE_SHA1 "CollisionDetection" )
1113elseif (USE_SHA1 STREQUAL "HTTPS" )
@@ -35,18 +37,14 @@ elseif(USE_SHA1 STREQUAL "CommonCrypto")
3537 set (GIT_SHA1_COMMON_CRYPTO 1)
3638elseif (USE_SHA1 STREQUAL "mbedTLS" )
3739 set (GIT_SHA1_MBEDTLS 1)
38- list (APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR} )
39- list (APPEND LIBGIT2_SYSTEM_LIBS ${MBEDTLS_LIBRARIES} )
40- # mbedTLS has no pkgconfig file, hence we can't require it
41- # https://github.com/ARMmbed/mbedtls/issues/228
42- # For now, pass its link flags as our own
43- list (APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES} )
4440elseif (USE_SHA1 STREQUAL "Win32" )
4541 set (GIT_SHA1_WIN32 1)
4642else ()
4743 message (FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1} " )
4844endif ()
4945
46+ # sha256
47+
5048if (USE_SHA256 STREQUAL ON AND USE_HTTPS)
5149 SET (USE_SHA256 "HTTPS" )
5250elseif (USE_SHA256 STREQUAL ON )
@@ -67,9 +65,24 @@ if(USE_SHA256 STREQUAL "Builtin")
6765 set (GIT_SHA256_BUILTIN 1)
6866elseif (USE_SHA256 STREQUAL "CommonCrypto" )
6967 set (GIT_SHA256_COMMON_CRYPTO 1)
68+ elseif (USE_SHA256 STREQUAL "mbedTLS" )
69+ set (GIT_SHA256_MBEDTLS 1)
7070else ()
7171 message (FATAL_ERROR "Asked for unknown SHA256 backend: ${USE_SHA256} " )
7272endif ()
7373
74+ # add library requirements
75+
76+ if (USE_SHA1 STREQUAL "mbedTLS" OR USE_SHA256 STREQUAL "mbedTLS" )
77+ list (APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR} )
78+ list (APPEND LIBGIT2_SYSTEM_LIBS ${MBEDTLS_LIBRARIES} )
79+ # mbedTLS has no pkgconfig file, hence we can't require it
80+ # https://github.com/ARMmbed/mbedtls/issues/228
81+ # For now, pass its link flags as our own
82+ list (APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES} )
83+ endif ()
84+
85+ # notify feature enablement
86+
7487add_feature_info(SHA1 ON "using ${USE_SHA1} " )
7588add_feature_info(SHA256 ON "using ${USE_SHA256} " )
0 commit comments