From 2132708ac2a179502fdf39896a4984c4a8a2fbc0 Mon Sep 17 00:00:00 2001 From: Sergei Nikulov Date: Tue, 25 Aug 2015 14:56:55 +0300 Subject: [PATCH] cmake: added Windows SSL support Closes #399 --- CMakeLists.txt | 20 ++++++++++++++++---- lib/curl_config.h.cmake | 3 +++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a42cc75c..2206a6b91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,10 +122,10 @@ endif() option(CURL_HIDDEN_SYMBOLS "Set to ON to hide libcurl internal symbols (=hide all symbols that aren't officially external)." ON) mark_as_advanced(CURL_HIDDEN_SYMBOLS) -# IF(WIN32) -# OPTION(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON) -# MARK_AS_ADVANCED(CURL_WINDOWS_SSPI) -# ENDIF() +IF(WIN32) + OPTION(CURL_WINDOWS_SSPI "Use windows libraries to allow NTLM authentication without openssl" ON) + MARK_AS_ADVANCED(CURL_WINDOWS_SSPI) +ENDIF() option(HTTP_ONLY "disables all protocols except HTTP (This overrides all CURL_DISABLE_* options)" OFF) mark_as_advanced(HTTP_ONLY) @@ -558,6 +558,18 @@ if(NOT UNIX) check_include_file_concat("winsock.h" HAVE_WINSOCK_H) check_include_file_concat("ws2tcpip.h" HAVE_WS2TCPIP_H) check_include_file_concat("winsock2.h" HAVE_WINSOCK2_H) + if(CURL_WINDOWS_SSPI) + set(CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} -DSECURITY_WIN32") + check_include_file_concat("sspi.h" HAVE_SSPI_H) + if(HAVE_SSPI_H) + check_include_file_concat("schannel.h" HAVE_SCHANNEL_H) + set(USE_WINDOWS_SSPI ON) + if(HAVE_SCHANNEL_H) + set(USE_SCHANNEL ON) + set(SSL_ENABLED ON) + endif() + endif() + endif() endif(NOT UNIX) check_include_file_concat("stdio.h" HAVE_STDIO_H) diff --git a/lib/curl_config.h.cmake b/lib/curl_config.h.cmake index 5376aa7e1..1c9f47365 100644 --- a/lib/curl_config.h.cmake +++ b/lib/curl_config.h.cmake @@ -919,6 +919,9 @@ /* to enable SSPI support */ #cmakedefine USE_WINDOWS_SSPI 1 +/* to enable Windows SSL */ +#cmakedefine USE_SCHANNEL 1 + /* Define to 1 if using yaSSL in OpenSSL compatibility mode. */ #cmakedefine USE_YASSLEMUL 1