build(cmake): Require SSL 1.1.1 or higher
Link using OpenSSL provided alises Remove Windows specifc check ssl macro for simpler check
This commit is contained in:
parent
eedb3ad1c3
commit
02c5418b9e
4 changed files with 16 additions and 24 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
|
@ -149,10 +149,12 @@ jobs:
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
env:
|
env:
|
||||||
VCPKG_ROOT: "" # Unset deliberately to suppress 'already installed' warning.
|
VCPKG_ROOT: ${{github.workspace}}/vcpkg
|
||||||
run: python ./scripts/install_deps.py
|
run: python ./scripts/install_deps.py
|
||||||
|
|
||||||
- name: Configure
|
- name: Configure
|
||||||
|
env:
|
||||||
|
VCPKG_ROOT: ${{github.workspace}}/vcpkg
|
||||||
run: cmake -B build --preset=windows-release
|
run: cmake -B build --preset=windows-release
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,8 @@
|
||||||
"generator": "Ninja",
|
"generator": "Ninja",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_C_COMPILER": "cl.exe",
|
"CMAKE_C_COMPILER": "cl.exe",
|
||||||
"CMAKE_CXX_COMPILER": "cl.exe"
|
"CMAKE_CXX_COMPILER": "cl.exe",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||||
},
|
},
|
||||||
"architecture": {
|
"architecture": {
|
||||||
"value": "x64",
|
"value": "x64",
|
||||||
|
|
|
||||||
|
|
@ -485,28 +485,10 @@ macro(configure_windows_libs)
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/res/win/version.rc.in
|
configure_file(${PROJECT_SOURCE_DIR}/res/win/version.rc.in
|
||||||
${PROJECT_BINARY_DIR}/src/version.rc @ONLY)
|
${PROJECT_BINARY_DIR}/src/version.rc @ONLY)
|
||||||
|
|
||||||
configure_windows_openssl()
|
configure_openssl()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(configure_windows_openssl)
|
|
||||||
set(OPENSSL_ROOT_DIR ${PROJECT_SOURCE_DIR}/vcpkg_installed/x64-windows)
|
|
||||||
set(OPENSSL_EXE_DIR ${OPENSSL_ROOT_DIR}/tools/openssl)
|
|
||||||
|
|
||||||
if(EXISTS ${OPENSSL_EXE_DIR})
|
|
||||||
message(VERBOSE "OpenSSL exe dir: ${OPENSSL_EXE_DIR}")
|
|
||||||
add_definitions(-DOPENSSL_EXE_DIR="${OPENSSL_EXE_DIR}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "OpenSSL exe dir not found: ${OPENSSL_EXE_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(EXISTS ${OPENSSL_ROOT_DIR})
|
|
||||||
message(VERBOSE "OpenSSL root dir: ${OPENSSL_ROOT_DIR}")
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "OpenSSL root dir not found: ${OPENSSL_ROOT_DIR}")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
macro(configure_python)
|
macro(configure_python)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
find_package(Python REQUIRED QUIET)
|
find_package(Python REQUIRED QUIET)
|
||||||
|
|
@ -538,8 +520,15 @@ macro(configure_openssl)
|
||||||
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
set(OPENSSL_USE_STATIC_LIBS TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL 1.1.1 REQUIRED COMPONENTS SSL Crypto)
|
||||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
if(WIN32) #Used for dev in TLS and WIX
|
||||||
|
cmake_path(SET OPENSSL_ROOT_DIR NORMALIZE
|
||||||
|
"${CMAKE_BINARY_DIR}/vcpkg_installed/x64-windows")
|
||||||
|
message(STATUS "SET OPENSSL ROOT: ${OPENSSL_ROOT_DIR}")
|
||||||
|
set(OPENSSL_EXE_DIR "${OPENSSL_ROOT_DIR}/tools/openssl")
|
||||||
|
add_definitions(-DOPENSSL_EXE_DIR="${OPENSSL_ROOT_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
macro(configure_gtest)
|
macro(configure_gtest)
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ add_library(net STATIC ${sources})
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
net
|
net
|
||||||
PUBLIC ${OPENSSL_LIBRARIES}
|
PUBLIC OpenSSL::SSL OpenSSL::Crypto
|
||||||
PRIVATE mt io)
|
PRIVATE mt io)
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue