Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
70db57d4
Unverified
Commit
70db57d4
authored
Jan 05, 2018
by
Edward Thomson
Committed by
GitHub
Jan 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4398 from pks-t/pks/generic-sha1
cmake: allow explicitly choosing SHA1 backend
parents
eebc5e0d
70aa6146
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
21 deletions
+27
-21
CMakeLists.txt
+1
-1
src/CMakeLists.txt
+26
-20
No files found.
CMakeLists.txt
View file @
70db57d4
...
...
@@ -42,7 +42,7 @@ OPTION( PROFILE "Generate profiling information" OFF )
OPTION
(
ENABLE_TRACE
"Enables tracing support"
OFF
)
OPTION
(
LIBGIT2_FILENAME
"Name of the produced binary"
OFF
)
OPTION
(
USE_SHA1DC
"Use SHA-1 with collision detection"
OFF
)
SET
(
SHA1_BACKEND
"CollisionDetection"
CACHE STRING
"Backend to use for SHA1. One of Generic, OpenSSL, Win32, CommonCrypto, CollisionDetection. "
)
OPTION
(
USE_SSH
"Link with libssh to enable SSH support"
ON
)
OPTION
(
USE_HTTPS
"Enable HTTPS support. Can be set to a specific backend"
ON
)
OPTION
(
USE_GSSAPI
"Link with libgssapi for SPNEGO auth"
OFF
)
...
...
src/CMakeLists.txt
View file @
70db57d4
...
...
@@ -122,10 +122,6 @@ ELSE ()
PKG_CHECK_MODULES
(
CURL libcurl
)
ENDIF
()
IF
(
NOT AMIGA
AND
(
USE_HTTPS STREQUAL
"OpenSSL"
OR USE_HTTPS STREQUAL
"ON"
))
FIND_PACKAGE
(
OpenSSL QUIET
)
ENDIF
()
IF
(
CURL_FOUND
)
SET
(
GIT_CURL 1
)
LIST
(
APPEND LIBGIT2_INCLUDES
${
CURL_INCLUDE_DIRS
}
)
...
...
@@ -178,6 +174,8 @@ IF (USE_HTTPS)
LIST
(
APPEND LIBGIT2_LIBS
${
COREFOUNDATION_LIBRARIES
}
${
SECURITY_LIBRARIES
}
)
LIST
(
APPEND LIBGIT2_PC_LIBS
${
COREFOUNDATION_LDFLAGS
}
${
SECURITY_LDFLAGS
}
)
ELSEIF
(
HTTPS_BACKEND STREQUAL
"OpenSSL"
)
FIND_PACKAGE
(
OpenSSL
)
IF
(
NOT OPENSSL_FOUND
)
MESSAGE
(
FATAL_ERROR
"Asked for OpenSSL TLS backend, but it wasn't found"
)
ENDIF
()
...
...
@@ -199,34 +197,42 @@ ELSE()
ENDIF
()
# Specify sha1 implementation
IF
(
USE_SHA1DC
)
ADD_FEATURE_INFO
(
SHA ON
"using SHA1DC"
)
IF
(
SHA1_BACKEND STREQUAL
"OpenSSL"
)
IF
(
NOT OPENSSL_FOUND
)
FIND_PACKAGE
(
OpenSSL
)
IF
(
NOT OPENSSL_FOUND
)
MESSAGE
(
FATAL_ERROR
"Requested OpenSSL SHA1 backend, but OpenSSL could not be found"
)
ENDIF
()
ENDIF
()
ADD_FEATURE_INFO
(
SHA ON
"using OpenSSL"
)
SET
(
GIT_SHA1_OPENSSL 1
)
IF
(
CMAKE_SYSTEM_NAME MATCHES
"FreeBSD"
)
LIST
(
APPEND LIBGIT2_PC_LIBS
"-lssl"
)
ELSE
()
SET
(
LIBGIT2_PC_REQUIRES
"
${
LIBGIT2_PC_REQUIRES
}
openssl"
)
ENDIF
()
ELSEIF
(
SHA1_BACKEND STREQUAL
"CollisionDetection"
)
ADD_FEATURE_INFO
(
SHA ON
"using CollisionDetection"
)
SET
(
GIT_SHA1_COLLISIONDETECT 1
)
ADD_DEFINITIONS
(
-DSHA1DC_NO_STANDARD_INCLUDES=1
)
ADD_DEFINITIONS
(
-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\
"common.h
\"
)
ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=
\"
common.h
\"
)
FILE(GLOB SRC_SHA1 hash/hash_collisiondetect.c hash/sha1dc/*)
ELSEIF (WIN32 AND NOT MINGW)
ADD_FEATURE_INFO(SHA ON "
using SHA1_WIN32
")
ELSEIF(SHA1_BACKEND STREQUAL "
Generic
")
ADD_FEATURE_INFO(SHA ON "
using Generic
")
FILE(GLOB SRC_SHA1 hash/hash_generic.c)
ELSEIF(SHA1_BACKEND STREQUAL "
Win32
")
ADD_FEATURE_INFO(SHA ON "
using Win32
")
SET(GIT_SHA1_WIN32 1)
FILE(GLOB SRC_SHA1 hash/hash_win32.c)
ELSEIF
(
${
CMAKE_SYSTEM_NAME
}
MATCHES "
Darwin
")
ELSEIF
(SHA1_BACKEND STREQUAL "
CommonCrypto
")
ADD_FEATURE_INFO(SHA ON "
using CommonCrypto
")
SET(GIT_SHA1_COMMON_CRYPTO 1)
ELSEIF (OPENSSL_FOUND)
ADD_FEATURE_INFO(SHA ON "
using OpenSSL
")
SET(GIT_SHA1_OPENSSL 1)
IF (CMAKE_SYSTEM_NAME MATCHES "
FreeBSD
")
LIST(APPEND LIBGIT2_PC_LIBS "
-lssl
")
ELSE()
SET(LIBGIT2_PC_REQUIRES "
${
LIBGIT2_PC_REQUIRES
}
openssl
")
ENDIF ()
ELSE()
ADD_FEATURE_INFO(SHA ON "
using generic
")
FILE(GLOB SRC_SHA1 hash/hash_generic.c)
MESSAGE(FATAL_ERROR "
Asked for unknown SHA1 backend
${
SHA1_BACKEND
}
")
ENDIF()
# Include POSIX regex when it is required
IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "
(
Solaris|SunOS
)
")
ADD_SUBDIRECTORY("
${
libgit2_SOURCE_DIR
}
/deps/regex
" "
${
libgit2_BINARY_DIR
}
/deps/regex
")
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment