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 ≥ 3.25 can use this simple capabilities check:

if(CMAKE_VERSION VERSION_GREATER_EQUAL 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}")
endif()

For older CMake, or to progamatically confirm that TLS and certificates are working, consider check_tls: