зеркало из https://github.com/microsoft/msquic.git
improve OpenSSL detection (#3390)
This commit is contained in:
Родитель
662ef33b8c
Коммит
289323d8b3
|
@ -90,6 +90,28 @@ if ("" -eq $Tls) {
|
|||
$Tls = "schannel"
|
||||
} else {
|
||||
$Tls = "openssl"
|
||||
try {
|
||||
# If no Tls was specified, try to guess it based on default OpenSSL version
|
||||
# This is more complicated in attempt to silently deal with missing openssl executable
|
||||
#
|
||||
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
|
||||
$pinfo.FileName = "openssl"
|
||||
$pinfo.Arguments = "version"
|
||||
$pinfo.RedirectStandardError = $true
|
||||
$pinfo.RedirectStandardOutput = $true
|
||||
$pinfo.UseShellExecute = $false
|
||||
|
||||
$p = New-Object System.Diagnostics.Process
|
||||
$p.StartInfo = $pinfo
|
||||
$p.Start() | Out-Null
|
||||
$p.WaitForExit()
|
||||
|
||||
$version = $p.StandardOutput.ReadToEnd()
|
||||
if ($version -like "OpenSSL 3*")
|
||||
{
|
||||
$Tls = "openssl3"
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -339,7 +339,11 @@ else()
|
|||
if (QUIC_USE_SYSTEM_LIBCRYPTO)
|
||||
include(FindOpenSSL)
|
||||
if (OPENSSL_FOUND)
|
||||
if (OPENSSL_VERSION VERSION_EQUAL EXPECTED_OPENSSL_VERSION OR OPENSSL_VERSION VERSION_GREATER EXPECTED_OPENSSL_VERSION)
|
||||
# Get Major.Minor so 3.0 can match 3.0.2.
|
||||
# We cannot use VERSION_GREATER as 3.0 would work for 1.1.1 but they are not compatible.
|
||||
string(FIND ${OPENSSL_VERSION} "." VERSIONLEN REVERSE)
|
||||
string(SUBSTRING ${OPENSSL_VERSION} 0 ${VERSIONLEN} OPENSSL_MAJORMINOR)
|
||||
if (OPENSSL_VERSION VERSION_EQUAL EXPECTED_OPENSSL_VERSION OR OPENSSL_MAJORMINOR VERSION_EQUAL EXPECTED_OPENSSL_VERSION)
|
||||
target_link_libraries(OpenSSLQuic INTERFACE OpenSSL::Crypto)
|
||||
else()
|
||||
message(FATAL_ERROR "OpenSSL ${EXPECTED_OPENSSL_VERSION} not found, found ${OPENSSL_VERSION}")
|
||||
|
|
Загрузка…
Ссылка в новой задаче