From f3e7e9cf9c1bb05c520f78f1e72fe983f4ea87f0 Mon Sep 17 00:00:00 2001 From: Rachel Powers <508861+Ryex@users.noreply.github.com> Date: Sun, 26 Mar 2023 21:39:41 -0700 Subject: [PATCH] print when searching for windows TLS libs --- CMakeLists.txt | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa612e70..c2e6601f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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)