Check CMake TLS functioning

CMake itself is built with SSL by default. If a user mistakenly builds CMake without SSL support, this is generally not usable as the vast majority of Internet sites require SSL / TLS to function. Confusing errors result for CMake network operations like file(DOWNLOAD) in this case.

CMake has a simple capabilities check:

cmake_minimum_required(VERSION 3.25)

execute_process(COMMAND ${CMAKE_COMMAND} -E capabilities OUTPUT_VARIABLE cap)

string(JSON has_tls GET ${cap} "tls")

message(STATUS "${CMAKE_COMMAND} TLS available: ${has_tls}")

To progamatically confirm that TLS and certificates are working, consider check_tls.

For a more complete check consider check_https.cmake