diff options
author | Carlos Martín Nieto <cmn@elego.de> | 2012-10-23 19:30:04 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@elego.de> | 2012-10-23 20:30:16 +0200 |
commit | 7205a4d94cdead95c397505292a31b4854039825 (patch) | |
tree | 8a82f69b1a26efb57577f451ccbf9771a70a0f47 /CMakeLists.txt | |
parent | 4c47a8bcfe03c42096b74d4af06ab95fb95fd211 (diff) | |
download | libgit2-7205a4d94cdead95c397505292a31b4854039825.tar.gz |
Use libcrypto's SHA-1 implementation when linking to it
libcryto's SHA-1 implementation is measurably better than the one that
ships with the library. If we link to it for HTTPS support already,
use that implementation instead.
Testing on a ~600MB of the linux repository, this reduces indexing
time by 40% and removes the hashing from the top spot in the perf
output.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 52929062d..434fba908 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,8 +40,10 @@ ENDIF() IF (SHA1_TYPE STREQUAL "ppc") ADD_DEFINITIONS(-DPPC_SHA1) FILE(GLOB SRC_SHA1 src/ppc/*.c src/ppc/*.S) +ELSEIF (OPENSSL_FOUND) # libcrypto's implementation is faster than ours + ADD_DEFINITIONS(-DOPENSSL_SHA) ELSE () - SET (SRC_SHA1) + FILE(GLOB SRC_SHA1 src/sha1/*.c) ENDIF() IF (NOT WIN32) @@ -198,7 +200,7 @@ IF (BUILD_CLAR) DEPENDS ${CLAR_PATH}/clar ${SRC_TEST} WORKING_DIRECTORY ${CLAR_PATH} ) - ADD_EXECUTABLE(libgit2_clar ${SRC} ${CLAR_PATH}/clar_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX}) + ADD_EXECUTABLE(libgit2_clar ${SRC} ${CLAR_PATH}/clar_main.c ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1}) TARGET_LINK_LIBRARIES(libgit2_clar ${CMAKE_THREAD_LIBS_INIT} ${SSL_LIBRARIES}) IF (MSVC) |