print when searching for windows TLS libs

pull/2045/head
Rachel Powers 2023-03-26 21:39:41 -07:00
parent fe4d34ff93
commit f3e7e9cf9c
1 changed files with 23 additions and 4 deletions

View File

@ -342,20 +342,39 @@ if(WITH_APPLETLS)
endif()
endif()
function(a2_wrap_find_library var_name lib)
message(STATUS "Looking for ${lib}")
find_library(${var_name} ${lib})
if(${var_name})
message(STATUS "Looking for ${lib} - found")
else()
message(STATUS "Looking for ${lib} - not found")
endif()
endfunction()
set(HAVE_WINTLS no CACHE BOOL "Define if you have Windows TLS support" FORCE)
set(HAVE_WINTLS_LIBS false)
set(HAVE_WINTLS_HEADERS false)
if(WITH_WINTLS)
if(WIN32)
find_library(HAVE_WINTLS_LIBS crypt32)
find_library(HAVE_WINTLS_LIBS secur32)
find_library(HAVE_WINTLS_LIBS advapi32)
a2_wrap_find_library(HAVE_CRYPT32 crypt32)
a2_wrap_find_library(HAVE_SECURE32 secur32)
a2_wrap_find_library(HAVE_ADVAPI32 advapi32)
if(HAVE_CRYPT32 AND HAVE_SECURE32 AND HAVE_ADVAPI32)
set(HAVE_WINTLS_LIBS true)
endif()
check_include_file_cxx(wincrypt.h HAVE_WINCRYPT_H)
if(HAVE_WINCRYPT_H)
list(APPEND a2_found_headers wincrypt.h)
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS "/D SECURITY_WIN32")
if(MSVC)
list(APPEND CMAKE_REQUIRED_DEFINITIONS "/D SECURITY_WIN32=1")
else()
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DSECURITY_WIN32=1)
endif()
check_include_file_cxx(security.h HAVE_SECURITY_H)
if(HAVE_SECURITY_H)
list(APPEND a2_found_headers security.h)