From 696239d6e1fa93d5a5ea8b37fac1a55c2da162fc Mon Sep 17 00:00:00 2001 From: mylogin Date: Thu, 21 Apr 2022 05:04:55 +0300 Subject: [PATCH] Link Windows crypto libs only when CPPHTTPLIB_OPENSSL_SUPPORT is set (#1254) --- httplib.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/httplib.h b/httplib.h index 26a327b..c7ecf74 100644 --- a/httplib.h +++ b/httplib.h @@ -144,8 +144,6 @@ using ssize_t = int; #include #include - -#include #include #ifndef WSA_FLAG_NO_HANDLE_INHERIT @@ -154,8 +152,6 @@ using ssize_t = int; #ifdef _MSC_VER #pragma comment(lib, "ws2_32.lib") -#pragma comment(lib, "crypt32.lib") -#pragma comment(lib, "cryptui.lib") #endif #ifndef strcasecmp @@ -220,14 +216,20 @@ using socket_t = int; #include #ifdef CPPHTTPLIB_OPENSSL_SUPPORT -// these are defined in wincrypt.h and it breaks compilation if BoringSSL is -// used #ifdef _WIN32 +#include + +// these are defined in wincrypt.h and it breaks compilation if BoringSSL is used #undef X509_NAME #undef X509_CERT_PAIR #undef X509_EXTENSIONS #undef PKCS7_SIGNER_INFO + +#ifdef _MSC_VER +#pragma comment(lib, "crypt32.lib") +#pragma comment(lib, "cryptui.lib") #endif +#endif //_WIN32 #include #include