Commit 2c154145 by Edward Thomson

cmake: move sha1 source selection into CMakeLists.txt

The select hashes module selects the hash; the CMakeLists.txt selects
the files to implement it.
parent c7f6ecb3
...@@ -24,7 +24,6 @@ if(USE_SHA1 STREQUAL "CollisionDetection") ...@@ -24,7 +24,6 @@ if(USE_SHA1 STREQUAL "CollisionDetection")
add_definitions(-DSHA1DC_NO_STANDARD_INCLUDES=1) add_definitions(-DSHA1DC_NO_STANDARD_INCLUDES=1)
add_definitions(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\") add_definitions(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
add_definitions(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\") add_definitions(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
file(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
elseif(USE_SHA1 STREQUAL "OpenSSL") elseif(USE_SHA1 STREQUAL "OpenSSL")
# OPENSSL_FOUND should already be set, we're checking USE_HTTPS # OPENSSL_FOUND should already be set, we're checking USE_HTTPS
...@@ -34,29 +33,20 @@ elseif(USE_SHA1 STREQUAL "OpenSSL") ...@@ -34,29 +33,20 @@ elseif(USE_SHA1 STREQUAL "OpenSSL")
else() else()
list(APPEND LIBGIT2_PC_REQUIRES "openssl") list(APPEND LIBGIT2_PC_REQUIRES "openssl")
endif() endif()
file(GLOB SRC_SHA1 hash/sha1/openssl.*)
elseif(USE_SHA1 STREQUAL "CommonCrypto") elseif(USE_SHA1 STREQUAL "CommonCrypto")
set(GIT_SHA1_COMMON_CRYPTO 1) set(GIT_SHA1_COMMON_CRYPTO 1)
file(GLOB SRC_SHA1 hash/sha1/common_crypto.*)
elseif(USE_SHA1 STREQUAL "mbedTLS") elseif(USE_SHA1 STREQUAL "mbedTLS")
set(GIT_SHA1_MBEDTLS 1) set(GIT_SHA1_MBEDTLS 1)
file(GLOB SRC_SHA1 hash/sha1/mbedtls.*)
list(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR}) list(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR})
list(APPEND LIBGIT2_LIBS ${MBEDTLS_LIBRARIES}) list(APPEND LIBGIT2_SYSTEM_LIBS ${MBEDTLS_LIBRARIES})
# mbedTLS has no pkgconfig file, hence we can't require it # mbedTLS has no pkgconfig file, hence we can't require it
# https://github.com/ARMmbed/mbedtls/issues/228 # https://github.com/ARMmbed/mbedtls/issues/228
# For now, pass its link flags as our own # For now, pass its link flags as our own
list(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES}) list(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
elseif(USE_SHA1 STREQUAL "Win32") elseif(USE_SHA1 STREQUAL "Win32")
set(GIT_SHA1_WIN32 1) set(GIT_SHA1_WIN32 1)
file(GLOB SRC_SHA1 hash/sha1/win32.*) elseif(NOT (USE_SHA1 STREQUAL "Generic"))
elseif(USE_SHA1 STREQUAL "Generic")
file(GLOB SRC_SHA1 hash/sha1/generic.*)
else()
message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}") message(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
endif() endif()
list(APPEND SRC_SHA1 "hash/sha1.h")
list(SORT SRC_SHA1)
add_feature_info(SHA ON "using ${USE_SHA1}") add_feature_info(SHA ON "using ${USE_SHA1}")
...@@ -97,6 +97,21 @@ include(SelectSSH) ...@@ -97,6 +97,21 @@ include(SelectSSH)
include(SelectWinHTTP) include(SelectWinHTTP)
include(SelectZlib) include(SelectZlib)
if(USE_SHA1 STREQUAL "CollisionDetection")
file(GLOB SRC_SHA1 hash/sha1/collisiondetect.* hash/sha1/sha1dc/*)
elseif(USE_SHA1 STREQUAL "OpenSSL")
file(GLOB SRC_SHA1 hash/sha1/openssl.*)
elseif(USE_SHA1 STREQUAL "CommonCrypto")
file(GLOB SRC_SHA1 hash/sha1/common_crypto.*)
elseif(USE_SHA1 STREQUAL "mbedTLS")
file(GLOB SRC_SHA1 hash/sha1/mbedtls.*)
elseif(USE_SHA1 STREQUAL "Win32")
file(GLOB SRC_SHA1 hash/sha1/win32.*)
elseif(USE_SHA1 STREQUAL "Generic")
file(GLOB SRC_SHA1 hash/sha1/generic.*)
endif()
list(APPEND SRC_SHA1 "hash/sha1.h")
target_sources(git2internal PRIVATE ${SRC_SHA1}) target_sources(git2internal PRIVATE ${SRC_SHA1})
# Optional external dependency: ntlmclient # Optional external dependency: ntlmclient
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment