summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/Modules/SelectGSSAPI.cmake44
-rw-r--r--cmake/Modules/SelectHTTPSBackend.cmake57
-rw-r--r--cmake/Modules/SelectHashes.cmake46
-rw-r--r--deps/ntlmclient/CMakeLists.txt10
4 files changed, 66 insertions, 91 deletions
diff --git a/cmake/Modules/SelectGSSAPI.cmake b/cmake/Modules/SelectGSSAPI.cmake
index 9b2bb1fc5..0a42eeefd 100644
--- a/cmake/Modules/SelectGSSAPI.cmake
+++ b/cmake/Modules/SelectGSSAPI.cmake
@@ -1,35 +1,27 @@
-# Select the backend to use
-
-# We try to find any packages our backends might use
-
INCLUDE(SanitizeBool)
+# We try to find any packages our backends might use
FIND_PACKAGE(GSSAPI)
IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
INCLUDE(FindGSSFramework)
ENDIF()
-# Auto-select GSS backend
-SanitizeBool(USE_GSSAPI)
-IF (USE_GSSAPI STREQUAL ON)
- IF (GSSFRAMEWORK_FOUND)
- SET(GSS_BACKEND "GSS.framework")
- ELSEIF(GSSAPI_FOUND)
- SET(GSS_BACKEND "gssapi")
- ELSE()
- MESSAGE(FATAL_ERROR "Unable to autodetect a usable GSS backend."
- "Please pass the backend name explicitly (-DUSE_GSS=backend)")
+IF(USE_GSSAPI)
+ # Auto-select GSS backend
+ SanitizeBool(USE_GSSAPI)
+ IF (USE_GSSAPI STREQUAL ON)
+ IF (GSSFRAMEWORK_FOUND)
+ SET(USE_GSSAPI "GSS.framework")
+ ELSEIF(GSSAPI_FOUND)
+ SET(USE_GSSAPI "gssapi")
+ ELSE()
+ MESSAGE(FATAL_ERROR "Unable to autodetect a usable GSS backend."
+ "Please pass the backend name explicitly (-DUSE_GSS=backend)")
+ ENDIF()
ENDIF()
-ELSEIF(USE_GSSAPI)
- # Backend was explicitly set
- SET(GSS_BACKEND ${USE_GSSAPI})
-ELSE()
- SET(GSS_BACKEND NO)
-ENDIF()
-IF(GSS_BACKEND)
# Check that we can find what's required for the selected backend
- IF (GSS_BACKEND STREQUAL "GSS.framework")
+ IF (USE_GSSAPI STREQUAL "GSS.framework")
IF (NOT GSSFRAMEWORK_FOUND)
MESSAGE(FATAL_ERROR "Asked for GSS.framework backend, but it wasn't found")
ENDIF()
@@ -37,8 +29,8 @@ IF(GSS_BACKEND)
LIST(APPEND LIBGIT2_LIBS ${GSSFRAMEWORK_LIBRARIES})
SET(GIT_GSSFRAMEWORK 1)
- ADD_FEATURE_INFO(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${GSS_BACKEND})")
- ELSEIF (GSS_BACKEND STREQUAL "gssapi")
+ ADD_FEATURE_INFO(SPNEGO GIT_GSSFRAMEWORK "SPNEGO authentication support (${USE_GSSAPI})")
+ ELSEIF (USE_GSSAPI STREQUAL "gssapi")
IF (NOT GSSAPI_FOUND)
MESSAGE(FATAL_ERROR "Asked for gssapi GSS backend, but it wasn't found")
ENDIF()
@@ -46,9 +38,9 @@ IF(GSS_BACKEND)
LIST(APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES})
SET(GIT_GSSAPI 1)
- ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${GSS_BACKEND})")
+ ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support (${USE_GSSAPI})")
ELSE()
- MESSAGE(FATAL_ERROR "Asked for backend ${GSS_BACKEND} but it wasn't found")
+ MESSAGE(FATAL_ERROR "Asked for backend ${USE_GSSAPI} but it wasn't found")
ENDIF()
ELSE()
SET(GIT_GSSAPI 0)
diff --git a/cmake/Modules/SelectHTTPSBackend.cmake b/cmake/Modules/SelectHTTPSBackend.cmake
index f9b0b1cdc..afbeac424 100644
--- a/cmake/Modules/SelectHTTPSBackend.cmake
+++ b/cmake/Modules/SelectHTTPSBackend.cmake
@@ -1,5 +1,3 @@
-# Select the backend to use
-
INCLUDE(SanitizeBool)
# We try to find any packages our backends might use
@@ -10,36 +8,31 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PACKAGE(CoreFoundation)
ENDIF()
-# Auto-select TLS backend
-SanitizeBool(USE_HTTPS)
-IF (USE_HTTPS STREQUAL ON)
- IF (SECURITY_FOUND)
- IF (SECURITY_HAS_SSLCREATECONTEXT)
- SET(HTTPS_BACKEND "SecureTransport")
+IF(USE_HTTPS)
+ # Auto-select TLS backend
+ SanitizeBool(USE_HTTPS)
+ IF (USE_HTTPS STREQUAL ON)
+ IF (SECURITY_FOUND)
+ IF (SECURITY_HAS_SSLCREATECONTEXT)
+ SET(USE_HTTPS "SecureTransport")
+ ELSE()
+ MESSAGE(STATUS "Security framework is too old, falling back to OpenSSL")
+ SET(USE_HTTPS "OpenSSL")
+ ENDIF()
+ ELSEIF (WINHTTP)
+ SET(USE_HTTPS "WinHTTP")
+ ELSEIF(OPENSSL_FOUND)
+ SET(USE_HTTPS "OpenSSL")
+ ELSEIF(MBEDTLS_FOUND)
+ SET(USE_HTTPS "mbedTLS")
ELSE()
- MESSAGE(STATUS "Security framework is too old, falling back to OpenSSL")
- SET(HTTPS_BACKEND "OpenSSL")
+ MESSAGE(FATAL_ERROR "Unable to autodetect a usable HTTPS backend."
+ "Please pass the backend name explicitly (-DUSE_HTTPS=backend)")
ENDIF()
- ELSEIF (WINHTTP)
- SET(HTTPS_BACKEND "WinHTTP")
- ELSEIF(OPENSSL_FOUND)
- SET(HTTPS_BACKEND "OpenSSL")
- ELSEIF(MBEDTLS_FOUND)
- SET(HTTPS_BACKEND "mbedTLS")
- ELSE()
- MESSAGE(FATAL_ERROR "Unable to autodetect a usable HTTPS backend."
- "Please pass the backend name explicitly (-DUSE_HTTPS=backend)")
ENDIF()
-ELSEIF(USE_HTTPS)
- # HTTPS backend was explicitly set
- SET(HTTPS_BACKEND ${USE_HTTPS})
-ELSE()
- SET(HTTPS_BACKEND NO)
-ENDIF()
-IF(HTTPS_BACKEND)
# Check that we can find what's required for the selected backend
- IF (HTTPS_BACKEND STREQUAL "SecureTransport")
+ IF (USE_HTTPS STREQUAL "SecureTransport")
IF (NOT COREFOUNDATION_FOUND)
MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, CoreFoundation.framework not found")
ENDIF()
@@ -54,7 +47,7 @@ IF(HTTPS_BACKEND)
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${SECURITY_INCLUDE_DIR})
LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
- ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
+ ELSEIF (USE_HTTPS STREQUAL "OpenSSL")
IF (NOT OPENSSL_FOUND)
MESSAGE(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found")
ENDIF()
@@ -64,7 +57,7 @@ IF(HTTPS_BACKEND)
LIST(APPEND LIBGIT2_LIBS ${OPENSSL_LIBRARIES})
LIST(APPEND LIBGIT2_PC_LIBS ${OPENSSL_LDFLAGS})
LIST(APPEND LIBGIT2_PC_REQUIRES "openssl")
- ELSEIF(HTTPS_BACKEND STREQUAL "mbedTLS")
+ ELSEIF(USE_HTTPS STREQUAL "mbedTLS")
IF (NOT MBEDTLS_FOUND)
MESSAGE(FATAL_ERROR "Asked for mbedTLS backend, but it wasn't found")
ENDIF()
@@ -113,14 +106,14 @@ IF(HTTPS_BACKEND)
# https://github.com/ARMmbed/mbedtls/issues/228
# For now, pass its link flags as our own
LIST(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
- ELSEIF (HTTPS_BACKEND STREQUAL "WinHTTP")
+ ELSEIF (USE_HTTPS STREQUAL "WinHTTP")
# WinHTTP setup was handled in the WinHTTP-specific block above
ELSE()
- MESSAGE(FATAL_ERROR "Asked for backend ${HTTPS_BACKEND} but it wasn't found")
+ MESSAGE(FATAL_ERROR "Asked for backend ${USE_HTTPS} but it wasn't found")
ENDIF()
SET(GIT_HTTPS 1)
- ADD_FEATURE_INFO(HTTPS GIT_HTTPS "using ${HTTPS_BACKEND}")
+ ADD_FEATURE_INFO(HTTPS GIT_HTTPS "using ${USE_HTTPS}")
ELSE()
SET(GIT_HTTPS 0)
ADD_FEATURE_INFO(HTTPS NO "")
diff --git a/cmake/Modules/SelectHashes.cmake b/cmake/Modules/SelectHashes.cmake
index a1339c173..27059db6f 100644
--- a/cmake/Modules/SelectHashes.cmake
+++ b/cmake/Modules/SelectHashes.cmake
@@ -5,37 +5,28 @@ INCLUDE(SanitizeBool)
# USE_SHA1=CollisionDetection(ON)/HTTPS/Generic/OFF
SanitizeBool(USE_SHA1)
-IF(USE_SHA1 STREQUAL ON OR USE_SHA1 STREQUAL "CollisionDetection")
- SET(SHA1_BACKEND "CollisionDetection")
+IF(USE_SHA1 STREQUAL ON)
+ SET(USE_SHA1 "CollisionDetection")
ELSEIF(USE_SHA1 STREQUAL "HTTPS")
- message(STATUS "Checking HTTPS backend… ${HTTPS_BACKEND}")
- IF(HTTPS_BACKEND STREQUAL "SecureTransport")
- SET(SHA1_BACKEND "CommonCrypto")
- ELSEIF(HTTPS_BACKEND STREQUAL "WinHTTP")
- SET(SHA1_BACKEND "Win32")
- ELSEIF(HTTPS_BACKEND)
- SET(SHA1_BACKEND ${HTTPS_BACKEND})
+ IF(USE_HTTPS STREQUAL "SecureTransport")
+ SET(USE_SHA1 "CommonCrypto")
+ ELSEIF(USE_HTTPS STREQUAL "WinHTTP")
+ SET(USE_SHA1 "Win32")
+ ELSEIF(USE_HTTPS)
+ SET(USE_SHA1 ${USE_HTTPS})
ELSE()
+ SET(USE_SHA1 "CollisionDetection")
ENDIF()
- IF(NOT HTTPS_BACKEND)
- SET(SHA1_BACKEND "CollisionDetection")
- ENDIF()
- message(STATUS "Using SHA1 backend ${SHA1_BACKEND}")
-ELSEIF(USE_SHA1 STREQUAL "Generic")
- SET(SHA1_BACKEND "Generic")
-# ELSEIF(NOT USE_SHA1)
-ELSE()
- MESSAGE(FATAL_ERROR "Invalid value for USE_SHA1: ${USE_SHA1}")
ENDIF()
-IF(SHA1_BACKEND STREQUAL "CollisionDetection")
+IF(USE_SHA1 STREQUAL "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/sha1/collisiondetect.* hash/sha1/sha1dc/*)
-ELSEIF(SHA1_BACKEND STREQUAL "OpenSSL")
- # OPENSSL_FOUND should already be set, we're checking HTTPS_BACKEND
+ELSEIF(USE_SHA1 STREQUAL "OpenSSL")
+ # OPENSSL_FOUND should already be set, we're checking USE_HTTPS
SET(GIT_SHA1_OPENSSL 1)
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
@@ -44,10 +35,10 @@ ELSEIF(SHA1_BACKEND STREQUAL "OpenSSL")
LIST(APPEND LIBGIT2_PC_REQUIRES "openssl")
ENDIF()
FILE(GLOB SRC_SHA1 hash/sha1/openssl.*)
-ELSEIF(SHA1_BACKEND STREQUAL "CommonCrypto")
+ELSEIF(USE_SHA1 STREQUAL "CommonCrypto")
SET(GIT_SHA1_COMMON_CRYPTO 1)
FILE(GLOB SRC_SHA1 hash/sha1/common_crypto.*)
-ELSEIF(SHA1_BACKEND STREQUAL "mbedTLS")
+ELSEIF(USE_SHA1 STREQUAL "mbedTLS")
SET(GIT_SHA1_MBEDTLS 1)
FILE(GLOB SRC_SHA1 hash/sha1/mbedtls.*)
LIST(APPEND LIBGIT2_SYSTEM_INCLUDES ${MBEDTLS_INCLUDE_DIR})
@@ -56,14 +47,13 @@ ELSEIF(SHA1_BACKEND STREQUAL "mbedTLS")
# https://github.com/ARMmbed/mbedtls/issues/228
# For now, pass its link flags as our own
LIST(APPEND LIBGIT2_PC_LIBS ${MBEDTLS_LIBRARIES})
-ELSEIF(SHA1_BACKEND STREQUAL "Win32")
+ELSEIF(USE_SHA1 STREQUAL "Win32")
SET(GIT_SHA1_WIN32 1)
FILE(GLOB SRC_SHA1 hash/sha1/win32.*)
-ELSEIF(SHA1_BACKEND STREQUAL "Generic")
+ELSEIF(USE_SHA1 STREQUAL "Generic")
FILE(GLOB SRC_SHA1 hash/sha1/generic.*)
-# ELSEIF(NOT USE_SHA1)
ELSE()
- MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend: ${SHA1_BACKEND}")
+ MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend: ${USE_SHA1}")
ENDIF()
-ADD_FEATURE_INFO(SHA ON "using ${SHA1_BACKEND}")
+ADD_FEATURE_INFO(SHA ON "using ${USE_SHA1}")
diff --git a/deps/ntlmclient/CMakeLists.txt b/deps/ntlmclient/CMakeLists.txt
index 0a1339779..43d32185a 100644
--- a/deps/ntlmclient/CMakeLists.txt
+++ b/deps/ntlmclient/CMakeLists.txt
@@ -4,20 +4,20 @@ ADD_DEFINITIONS(-DNTLM_STATIC=1)
DISABLE_WARNINGS(implicit-fallthrough)
-IF (HTTPS_BACKEND STREQUAL "SecureTransport")
+IF(USE_HTTPS STREQUAL "SecureTransport")
ADD_DEFINITIONS(-DCRYPT_COMMONCRYPTO)
SET(SRC_NTLMCLIENT_CRYPTO "crypt_commoncrypto.c")
# CC_MD4 has been deprecated in macOS 10.15.
SET_SOURCE_FILES_PROPERTIES("crypt_commoncrypto.c" COMPILE_FLAGS "-Wno-deprecated")
-ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
+ELSEIF(USE_HTTPS STREQUAL "OpenSSL")
ADD_DEFINITIONS(-DCRYPT_OPENSSL)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
SET(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c")
-ELSEIF (HTTPS_BACKEND STREQUAL "mbedTLS")
+ELSEIF(USE_HTTPS STREQUAL "mbedTLS")
ADD_DEFINITIONS(-DCRYPT_MBEDTLS)
SET(SRC_NTLMCLIENT_CRYPTO "crypt_mbedtls.c")
-ELSE ()
- MESSAGE(FATAL_ERROR "Unable to use libgit2's HTTPS backend (${HTTPS_BACKEND}) for NTLM crypto")
+ELSE()
+ MESSAGE(FATAL_ERROR "Unable to use libgit2's HTTPS backend (${USE_HTTPS}) for NTLM crypto")
ENDIF()
ADD_LIBRARY(ntlmclient OBJECT ${SRC_NTLMCLIENT} ${SRC_NTLMCLIENT_CRYPTO})