cmake: enforce USE_SSH validity

Validate the USE_SSH option fits into our valid options; don't
assume a default.
This commit is contained in:
Edward Thomson
2024-10-22 10:17:08 +01:00
parent 0c675b8c84
commit 2125e3c64d
2 changed files with 4 additions and 2 deletions

View File

@@ -30,7 +30,7 @@ option(USE_THREADS "Use threads for parallel processing when possibl
option(USE_NSEC "Support nanosecond precision file mtimes and ctimes" ON)
# Backend selection
option(USE_SSH "Enable SSH support. Can be set to a specific backend" OFF)
set(USE_SSH "" CACHE STRING "Enables SSH support. One of libssh2, exec, or OFF. (Defaults to OFF.)")
option(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS" ON)
option(USE_SHA256 "Enable SHA256. Can be set to HTTPS/Builtin" ON)

View File

@@ -39,6 +39,8 @@ elseif(USE_SSH STREQUAL ON OR USE_SSH STREQUAL "libssh2")
set(GIT_SSH 1)
set(GIT_SSH_LIBSSH2 1)
add_feature_info(SSH ON "using libssh2")
else()
elseif(USE_SSH STREQUAL OFF OR USE_SSH STREQUAL "")
add_feature_info(SSH OFF "SSH transport support")
else()
message(FATAL_ERROR "unknown SSH option: ${USE_HTTP_PARSER}")
endif()