summaryrefslogtreecommitdiff
path: root/deps/ntlmclient/CMakeLists.txt
blob: 9c5e23d6002f326c9c9819108eb26764f969ba02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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)
	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)
	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")
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})