mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
It's hard to remember whether it's `-DUSE_HTTPS=mbedTLS` or `-DUSE_HTTPS=mbedtls`. Even worse for things like `builtin` which we may have been inconsistent about. Allow for case insensitive options.
40 lines
1.5 KiB
CMake
40 lines
1.5 KiB
CMake
file(GLOB SRC_NTLMCLIENT "ntlm.c" "ntlm.h" "util.c" "util.h")
|
|
list(SORT SRC_NTLMCLIENT)
|
|
|
|
add_definitions(-DNTLM_STATIC=1)
|
|
|
|
disable_warnings(implicit-fallthrough)
|
|
|
|
if(USE_ICONV)
|
|
add_definitions(-DUNICODE_ICONV=1)
|
|
file(GLOB SRC_NTLMCLIENT_UNICODE "unicode_iconv.c" "unicode_iconv.h")
|
|
else()
|
|
add_definitions(-DUNICODE_BUILTIN=1)
|
|
file(GLOB SRC_NTLMCLIENT_UNICODE "unicode_builtin.c" "unicode_builtin.h")
|
|
endif()
|
|
|
|
if(USE_HTTPS STREQUAL "securetransport")
|
|
add_definitions(-DCRYPT_COMMONCRYPTO)
|
|
set(SRC_NTLMCLIENT_CRYPTO "crypt_commoncrypto.c" "crypt_commoncrypto.h")
|
|
# CC_MD4 has been deprecated in macOS 10.15.
|
|
set_source_files_properties("crypt_commoncrypto.c" COMPILE_FLAGS "-Wno-deprecated")
|
|
elseif(USE_HTTPS STREQUAL "openssl")
|
|
add_definitions(-DCRYPT_OPENSSL)
|
|
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
set(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c" "crypt_openssl.h")
|
|
elseif(USE_HTTPS STREQUAL "openssl-dynamic")
|
|
add_definitions(-DCRYPT_OPENSSL)
|
|
add_definitions(-DCRYPT_OPENSSL_DYNAMIC)
|
|
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
|
set(SRC_NTLMCLIENT_CRYPTO "crypt_openssl.c" "crypt_openssl.h")
|
|
elseif(USE_HTTPS STREQUAL "mbedtls")
|
|
add_definitions(-DCRYPT_MBEDTLS)
|
|
include_directories(${MBEDTLS_INCLUDE_DIR})
|
|
set(SRC_NTLMCLIENT_CRYPTO "crypt_mbedtls.c" "crypt_mbedtls.h" "crypt_builtin_md4.c")
|
|
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_UNICODE} ${SRC_NTLMCLIENT_CRYPTO})
|