mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 11:14:39 +00:00
Update CMakeLists.txt to include OpenSSL include directories and check for SHA256_Init function
This commit is contained in:
@@ -161,9 +161,14 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake-modules")
|
||||
|
||||
# include(FindLibreSSL.cmake)
|
||||
|
||||
# Check for OpenSSL and SHA256_Init
|
||||
find_package(OpenSSL QUIET)
|
||||
find_package(LibreSSL QUIET)
|
||||
|
||||
include(CheckFunctionExists)
|
||||
set(CMAKE_REQUIRED_LIBRARIES OpenSSL::Crypto)
|
||||
check_function_exists(SHA256_Init HAVE_OPENSSL_SHA256_INIT)
|
||||
|
||||
if(OpenSSL_FOUND)
|
||||
message("-- OpenSSL VERSION: ${OPENSSL_VERSION}")
|
||||
endif()
|
||||
@@ -172,13 +177,13 @@ if(LIBRESSL_FOUND)
|
||||
message("-- LibreSSL VERSION: ${LIBRESSL_VERSION}")
|
||||
endif()
|
||||
|
||||
if(OpenSSL_FOUND OR LIBRESSL_FOUND)
|
||||
if((OpenSSL_FOUND OR LIBRESSL_FOUND) AND HAVE_OPENSSL_SHA256_INIT)
|
||||
add_compile_definitions(AARU_HAS_SHA256)
|
||||
endif()
|
||||
|
||||
if(LIBRESSL_FOUND)
|
||||
TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE(aaruformat ${LIBRESSL_CRYPTO_LIBRARY})
|
||||
elseif(OpenSSL_FOUND)
|
||||
elif(OpenSSL_FOUND)
|
||||
TARGET_LINK_LIBRARIES_WHOLE_ARCHIVE(aaruformat ${OPENSSL_CRYPTO_LIBRARY})
|
||||
endif()
|
||||
|
||||
|
||||
@@ -37,6 +37,6 @@ target_link_libraries(tests_run PRIVATE gtest gtest_main aaruformat)
|
||||
if(LIBRESSL_FOUND)
|
||||
target_link_libraries(tests_run PRIVATE ${LIBRESSL_CRYPTO_LIBRARY})
|
||||
elseif(OpenSSL_FOUND)
|
||||
target_link_libraries(tests_run ${OPENSSL_CRYPTO_LIBRARY})
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
target_link_libraries(tests_run PRIVATE ${OPENSSL_CRYPTO_LIBRARY})
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user