ddnet/cmake/FindCrypto.cmake
heinrich5991 b986e54039 Add the SHA256 cryptographic hash function
Use the OpenSSL implementation of SHA256 if it is supported, otherwise
fall back to a public domain one.
2019-03-08 02:22:57 +01:00

20 lines
538 B
CMake

if(NOT PREFER_BUNDLED_LIBS)
find_package(OpenSSL)
if(OPENSSL_FOUND)
set(CRYPTO_FOUND ON)
set(CRYPTO_BUNDLED OFF)
set(CRYPTO_LIBRARY ${OPENSSL_CRYPTO_LIBRARY})
set(CRYPTO_INCLUDEDIR ${OPENSSL_INCLUDE_DIR})
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Crypto DEFAULT_MSG CRYPTO_LIBRARY CRYPTO_INCLUDEDIR)
mark_as_advanced(CRYPTO_LIBRARY CRYPTO_INCLUDEDIR)
if(CRYPTO_FOUND)
set(CRYPTO_LIBRARIES ${CRYPTO_LIBRARY})
set(CRYPTO_INCLUDE_DIRS ${CRYPTO_INCLUDEDIR})
endif()