From 2649906736399fa3dfa7c026159b6c47ca22eb44 Mon Sep 17 00:00:00 2001 From: Ake Hedman Date: Wed, 7 Jun 2023 23:03:19 +0200 Subject: [PATCH] Fixed openssl build defines --- .gitmodules | 2 +- CMakeLists.txt | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index b4f3398..ade6cdc 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,7 @@ url = https://github.com/gabime/spdlog.git [submodule "third_party/fastpbkdf2"] path = third_party/fastpbkdf2 - url = https://github.com/ctz/fastpbkdf2.git + url = https://github.com/danpashin/fastpbkdf2.git [submodule "third_party/nlohmann"] path = third_party/nlohmann url = https://github.com/nlohmann/json.git diff --git a/CMakeLists.txt b/CMakeLists.txt index a2062b1..967ad62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,11 +210,34 @@ endif(WIN32) # Set sockettcp build flags add_definitions(-DUSE_IPV6) -string(FIND "${OPENSSL_VERSION}" "1.1." SSL_VER_POS) + +set(OPENSSL_VER "OPENSSL_API_${OPENSSL_VERSION_MAJOR}_${OPENSSL_VERSION_MINOR}") +message(STATUS "OPENSSL Version: ${OPENSSL_VER}") +add_definitions(-D${OPENSSL_VER}) + +# 1.1.0 / 1.1.1 / 3.0.0 / 3.1.0 +string(FIND "${OPENSSL_VERSION}" "1.0" SSL_VER_POS) if(${SSL_VER_POS}) - add_definitions(-DOPENSSL_API_1_0) -else() - add_definitions(-DOPENSSL_API_1_1) + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_API_1_0") + #add_definitions(-DOPENSSL_API_1_0) +endif() + +string(FIND "${OPENSSL_VERSION}" "1.1" SSL_VER_POS) +if(${SSL_VER_POS}) + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DOPENSSL_API_1_1") + #add_definitions(-DOPENSSL_API_1_1) +endif() + +string(FIND "${OPENSSL_VERSION}" "3.0" SSL_VER_POS) +if(NOT SSL_VER_POS EQUAL -1) + #add_definitions(-DOPENSSL_API_3_0) + message(STATUS "openssl test ${SSL_VER_POS}") +endif() + +string(FIND "${OPENSSL_VERSION}" "3.1" SSL_VER_POS) +if(NOT SSL_VER_POS EQUAL -1) + add_definitions(-DOPENSSL_API_3_0) + message(STATUS "Open ssl version is 3.1 but set to 3.0 ${SSL_VER_POS} fir Civetweb. That is OK") endif() set(RESOURCE_FILES