Added support for building with different OpenSSL distributions on Windows

This commit is contained in:
Günter Obiltschnig 2019-06-22 14:49:42 +02:00
parent a45598d45a
commit fb98f58d84
2 changed files with 52 additions and 14 deletions

View File

@ -26,6 +26,10 @@
#endif
#define POCO_EXTERNAL_OPENSSL_DEFAULT 1
#define POCO_EXTERNAL_OPENSSL_SLPRO 2
#include "Poco/Foundation.h"
#include <openssl/opensslv.h>
@ -114,6 +118,34 @@ enum RSAPaddingMode
#pragma comment(lib, "legacy_stdio_definitions.lib")
#pragma comment(lib, "legacy_stdio_wide_specifiers.lib")
#endif
#elif defined(POCO_EXTERNAL_OPENSSL)
#if POCO_EXTERNAL_OPENSSL == POCO_EXTERNAL_OPENSSL_SLPRO
#if defined(POCO_DLL)
#if OPENSSL_VERSION_PREREQ(1,1)
#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "libssl.lib")
#else
#pragma comment(lib, "libeay32.lib")
#pragma comment(lib, "ssleay32.lib")
#endif
#else
#if OPENSSL_VERSION_PREREQ(1,1)
#pragma comment(lib, "libcrypto" POCO_LIB_SUFFIX)
#pragma comment(lib, "libssl" POCO_LIB_SUFFIX)
#else
#pragma comment(lib, "libeay32" POCO_LIB_SUFFIX)
#pragma comment(lib, "ssleay32" POCO_LIB_SUFFIX)
#endif
#endif
#elif POCO_EXTERNAL_OPENSSL == POCO_EXTERNAL_OPENSSL_DEFAULT
#if OPENSSL_VERSION_PREREQ(1,1)
#pragma comment(lib, "libcrypto.lib")
#pragma comment(lib, "libssl.lib")
#else
#pragma comment(lib, "libeay32.lib")
#pragma comment(lib, "ssleay32.lib")
#endif
#endif
#endif // POCO_INTERNAL_OPENSSL_MSVC_VER
#if !defined(Crypto_EXPORTS)
#pragma comment(lib, "PocoCrypto" POCO_LIB_SUFFIX)
@ -131,7 +163,7 @@ void Crypto_API initializeCrypto();
/// libraries, by calling OpenSSLInitializer::initialize().
///
/// Should be called before using any class from the Crypto library.
/// The Crypto library will be initialized automatically, through
/// The Crypto library will be initialized automatically, through
/// OpenSSLInitializer instances held by various Crypto classes
/// (Cipher, CipherKey, RSAKey, X509Certificate).
/// However, it is recommended to call initializeCrypto()
@ -140,10 +172,10 @@ void Crypto_API initializeCrypto();
/// Can be called multiple times; however, for every call to
/// initializeCrypto(), a matching call to uninitializeCrypto()
/// must be performed.
void Crypto_API uninitializeCrypto();
/// Uninitializes the Crypto library by calling
/// Uninitializes the Crypto library by calling
/// OpenSSLInitializer::uninitialize().

View File

@ -170,23 +170,29 @@
// #define POCO_LOG_DEBUG
// OpenSSL on Windows
//
// OpenSSL options
//
// Poco has its own OpenSSL build system.
// See https://github.com/pocoproject/openssl/blob/master/README.md
// for details
// See <https://github.com/pocoproject/openssl/blob/master/README.md>
// for details.
//
// These options are Windows only.
// Disable the use of Poco OpenSSL binaries
// (external OpenSSL libraries must be provided).
// #define POCO_EXTERNAL_OPENSSL
//
// End OpenSSL options
// To disable the use of Poco-provided OpenSSL binaries,
// define POCO_EXTERNAL_OPENSSL.
//
// Possible values:
// POCO_EXTERNAL_OPENSSL_SLPRO:
// Automatically link OpenSSL libraries from OpenSSL Windows installer provided
// by Shining Light Productions <http://slproweb.com/products/Win32OpenSSL.html>
// The (global) library search path must be set accordingly.
// POCO_EXTERNAL_OPENSSL_DEFAULT:
// Automatically link OpenSSL libraries from standard OpenSSL Windows build.
// The (global) library search path must be set accordingly.
// empty or other value:
// Do not link any OpenSSL libraries automatically. You will have to edit the
// Visual C++ project files for Crypto and NetSSL_OpenSSL.
#define POCO_EXTERNAL_OPENSSL POCO_EXTERNAL_OPENSSL_SLPRO
// Define to prevent changing the suffix for shared libraries