Skip to content

Commit d1d6578

Browse files
committed
cmake: enforce USE_HTTPS validity
1 parent 2125e3c commit d1d6578

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ option(USE_NSEC "Support nanosecond precision file mtimes and cti
3131

3232
# Backend selection
3333
set(USE_SSH "" CACHE STRING "Enables SSH support. One of libssh2, exec, or OFF. (Defaults to OFF.)")
34-
option(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
34+
set(USE_HTTPS "" CACHE STRING "Enable HTTPS support. One of ON (to autodetect), OFF, or a specific backend: OpenSSL, OpenSSL-FIPS, OpenSSL-Dynamic, mbedTLS, SecureTransport, Schannel, or WinHTTP. (Defaults to ON.)")
3535
option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS" ON)
3636
option(USE_SHA256 "Enable SHA256. Can be set to HTTPS/Builtin" ON)
3737
option(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
@@ -64,7 +64,7 @@ option(ENABLE_WERROR "Enable compilation with -Werror"
6464

6565
if(UNIX)
6666
# NTLM client requires crypto libraries from the system HTTPS stack
67-
if(NOT USE_HTTPS)
67+
if(USE_HTTPS STREQUAL "OFF")
6868
option(USE_NTLMCLIENT "Enable NTLM support on Unix." OFF)
6969
else()
7070
option(USE_NTLMCLIENT "Enable NTLM support on Unix." ON)

cmake/SelectHTTPSBackend.cmake

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,14 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin" OR CMAKE_SYSTEM_NAME MATCHES "iOS")
88
find_package(CoreFoundation)
99
endif()
1010

11+
if(USE_HTTPS STREQUAL "")
12+
set(USE_HTTPS ON)
13+
endif()
14+
15+
sanitizebool(USE_HTTPS)
16+
1117
if(USE_HTTPS)
1218
# Auto-select TLS backend
13-
sanitizebool(USE_HTTPS)
1419
if(USE_HTTPS STREQUAL ON)
1520
if(SECURITY_FOUND)
1621
if(SECURITY_HAS_SSLCREATECONTEXT)
@@ -136,12 +141,12 @@ if(USE_HTTPS)
136141
set(GIT_OPENSSL_DYNAMIC 1)
137142
list(APPEND LIBGIT2_SYSTEM_LIBS dl)
138143
else()
139-
message(FATAL_ERROR "Asked for backend ${USE_HTTPS} but it wasn't found")
144+
message(FATAL_ERROR "unknown HTTPS backend: ${USE_HTTPS}")
140145
endif()
141146

142147
set(GIT_HTTPS 1)
143148
add_feature_info(HTTPS GIT_HTTPS "using ${USE_HTTPS}")
144149
else()
145150
set(GIT_HTTPS 0)
146-
add_feature_info(HTTPS NO "")
151+
add_feature_info(HTTPS NO "HTTPS support is disabled")
147152
endif()

0 commit comments

Comments
 (0)