Skip to content

Commit

Permalink
Merge pull request #2 from hjmallon/_hm_fix_centos9
Browse files Browse the repository at this point in the history
Fix OpenSSL Crypto hunter-build and linking on Linux
  • Loading branch information
rbsheth authored Oct 21, 2022
2 parents 5825fcb + da65b7e commit 0492bf1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ set(CMAKE_CXX_RESPONSE_FILE_LINK_FLAG "@")

include("cmake/HunterGate.cmake")
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.314.tar.gz"
SHA1 "95c47c92f68edb091b5d6d18924baabe02a6962a"
URL "https://github.com/cpp-pm/hunter/archive/v0.24.7.tar.gz"
SHA1 "908ddcb223f25fa155315baae64ce0ab48a38bf7"
)

if(COMMAND apply_pre_project_platform_settings)
Expand Down
22 changes: 22 additions & 0 deletions cmake/Findcrypto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ if (TARGET crypto OR TARGET AWS::crypto)
message(STATUS "crypto Include Dir: ${crypto_INCLUDE_DIR}")
set(CRYPTO_FOUND true)
set(crypto_FOUND true)

elseif(TARGET OpenSSL::Crypto)
set(CRYPTO_FOUND true)
set(crypto_FOUND true)

get_target_property(crypto_INCLUDE_DIR OpenSSL::Crypto INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(crypto_LIBRARY OpenSSL::Crypto IMPORTED_LOCATION)

message(STATUS "LibCrypto from OpenSSL::Crypto")
message(STATUS "LibCrypto Include Dir: ${crypto_INCLUDE_DIR}")
message(STATUS "LibCrypto Lib: ${crypto_LIBRARY}")

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
add_library(AWS::crypto UNKNOWN IMPORTED)
set_target_properties(AWS::crypto PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${crypto_INCLUDE_DIR}")
set_target_properties(AWS::crypto PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${crypto_LIBRARY}")
add_dependencies(AWS::crypto Threads::Threads)

else()
find_path(crypto_INCLUDE_DIR
NAMES openssl/crypto.h
Expand Down
3 changes: 3 additions & 0 deletions cmake/external_dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ elseif(ENABLE_OPENSSL_ENCRYPTION)
set(USE_OPENSSL ON)
message(STATUS " Building Openssl as part of AWS SDK")
else()
hunter_add_package(OpenSSL)
find_package(OpenSSL REQUIRED)

find_package(crypto REQUIRED)
endif()
set(CRYPTO_LIBS ${CRYPTO_TARGET_NAME} ${ZLIB_LIBRARIES})
Expand Down

0 comments on commit 0492bf1

Please sign in to comment.