Configure openssl certificate dir correctly during build (#1934)

* Configure openssl certificate dir correctly during build

* Fix messages
This commit is contained in:
Thad House 2021-08-24 09:53:13 -07:00 коммит произвёл GitHub
Родитель 230e88bcd7
Коммит f28f48a156
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 26 добавлений и 0 удалений

Просмотреть файл

@ -31,6 +31,11 @@ set(OPENSSL_CONFIG_FLAGS
if (WIN32)
if (DEFINED ENV{CommonProgramFiles})
message(STATUS "Setting openssldir to $ENV{CommonProgramFiles}\\SSL")
list(APPEND OPENSSL_CONFIG_FLAGS --openssldir=\"$ENV{CommonProgramFiles}\\SSL\")
endif()
set(LIBSSL_DEBUG_PATH ${OPENSSL_DIR}/debug/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBCRYPTO_DEBUG_PATH ${OPENSSL_DIR}/debug/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBSSL_PATH ${OPENSSL_DIR}/release/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX})
@ -156,6 +161,27 @@ else()
set(LIBSSL_PATH ${OPENSSL_DIR}/lib/libssl${CMAKE_STATIC_LIBRARY_SUFFIX})
set(LIBCRYPTO_PATH ${OPENSSL_DIR}/lib/libcrypto${CMAKE_STATIC_LIBRARY_SUFFIX})
# Figure out the default cert directory
execute_process(
COMMAND openssl version -d
RESULT_VARIABLE OPENSSL_VERSION_RESULT
OUTPUT_VARIABLE FULL_OPENSSL_CERT_DIR)
if (OPENSSL_VERSION_RESULT STREQUAL 0)
# PARSE OPENSSLDIR
string(REGEX MATCH "OPENSSLDIR:.*\"(.+)\"" OPENSSL_CERT_MATCH_VAR ${FULL_OPENSSL_CERT_DIR})
if (CMAKE_MATCH_COUNT EQUAL 1)
message(STATUS "Setting openssldir to ${CMAKE_MATCH_1}")
list(APPEND OPENSSL_CONFIG_FLAGS --openssldir=\"${CMAKE_MATCH_1}\")
set(CONFIGURED_OPENSSL_CERT_DIR TRUE)
endif()
endif()
if (NOT CONFIGURED_OPENSSL_CERT_DIR)
message(STATUS "Setting openssldir to default /usr/local/ssl")
list(APPEND OPENSSL_CONFIG_FLAGS --openssldir=/usr/local/ssl)
endif()
list(APPEND OPENSSL_CONFIG_FLAGS --prefix=${OPENSSL_DIR})
if (QUIC_ENABLE_SANITIZERS)