mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Add OpenSSL and LibreSSL support for tests using crypto functions
This commit is contained in:
@@ -5,6 +5,10 @@ project(tests)
|
|||||||
add_subdirectory(lib)
|
add_subdirectory(lib)
|
||||||
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
include_directories(${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})
|
||||||
|
|
||||||
|
# Find OpenSSL for tests that use it directly
|
||||||
|
find_package(OpenSSL QUIET)
|
||||||
|
find_package(LibreSSL QUIET)
|
||||||
|
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/random
|
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/random
|
||||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data/)
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data/)
|
||||||
|
|
||||||
@@ -23,4 +27,13 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/data/data.bin
|
|||||||
# 'Google_Tests_run' is the target name
|
# 'Google_Tests_run' is the target name
|
||||||
# 'test1.cpp tests2.cpp' are source files with tests
|
# 'test1.cpp tests2.cpp' are source files with tests
|
||||||
add_executable(tests_run crc64.cpp spamsum.cpp crc32.c crc32.h flac.cpp lzma.cpp sha256.cpp)
|
add_executable(tests_run crc64.cpp spamsum.cpp crc32.c crc32.h flac.cpp lzma.cpp sha256.cpp)
|
||||||
|
|
||||||
|
# Link libraries including OpenSSL for SHA256 test
|
||||||
target_link_libraries(tests_run gtest gtest_main "aaruformat")
|
target_link_libraries(tests_run gtest gtest_main "aaruformat")
|
||||||
|
|
||||||
|
# Link OpenSSL/LibreSSL for tests that use crypto functions directly
|
||||||
|
if(LIBRESSL_FOUND)
|
||||||
|
target_link_libraries(tests_run ${LIBRESSL_CRYPTO_LIBRARY})
|
||||||
|
elseif(OpenSSL_FOUND)
|
||||||
|
target_link_libraries(tests_run ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|||||||
Reference in New Issue
Block a user