Skip to content

Commit

Permalink
Install OpenSSL libraries (#203)
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Walworth <[email protected]>
  • Loading branch information
rwalworth authored Feb 17, 2023
1 parent 5f4154b commit 57248d2
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions BuildOpenSSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ else ()
set(OPENSSL_BYPRODUCT_DIR ${OPENSSL_INSTALL_DIR}/lib)
endif ()

set(OPENSSL_CRYPTO_LIB ${OPENSSL_BYPRODUCT_DIR}/libcrypto${OPENSSL_LIBRARY_EXTENSION})
set(OPENSSL_SSL_LIB ${OPENSSL_BYPRODUCT_DIR}/libssl${OPENSSL_LIBRARY_EXTENSION})

ExternalProject_Add(OpenSSL
SOURCE_DIR ${OPENSSL_SOURCE_DIR}
GIT_REPOSITORY https://github.com/openssl/openssl.git
Expand All @@ -31,7 +34,7 @@ ExternalProject_Add(OpenSSL
TEST_COMMAND ""
INSTALL_COMMAND ${OPENSSL_INSTALL_COMMAND}
INSTALL_DIR ${OPENSSL_INSTALL_DIR}
BUILD_BYPRODUCTS ${OPENSSL_BYPRODUCT_DIR}/libcrypto${OPENSSL_LIBRARY_EXTENSION} ${OPENSSL_BYPRODUCT_DIR}/libssl${OPENSSL_LIBRARY_EXTENSION}
BUILD_BYPRODUCTS ${OPENSSL_CRYPTO_LIB} ${OPENSSL_SSL_LIB}
UPDATE_COMMAND ""
)

Expand All @@ -40,11 +43,14 @@ ExternalProject_Add(OpenSSL
file(MAKE_DIRECTORY ${OPENSSL_INCLUDE_DIR})

add_library(OpenSSL::Crypto STATIC IMPORTED GLOBAL)
set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_LOCATION ${OPENSSL_BYPRODUCT_DIR}/libcrypto${OPENSSL_LIBRARY_EXTENSION})
set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_LOCATION ${OPENSSL_CRYPTO_LIB})
set_property(TARGET OpenSSL::Crypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR})
add_dependencies(OpenSSL::Crypto OpenSSL)

add_library(OpenSSL::SSL STATIC IMPORTED GLOBAL)
set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_LOCATION ${OPENSSL_BYPRODUCT_DIR}/libssl${OPENSSL_LIBRARY_EXTENSION})
set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_LOCATION ${OPENSSL_SSL_LIB})
set_property(TARGET OpenSSL::SSL PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR})
add_dependencies(OpenSSL::SSL OpenSSL)
add_dependencies(OpenSSL::SSL OpenSSL)

install(FILES ${OPENSSL_CRYPTO_LIB} TYPE LIB)
install(FILES ${OPENSSL_SSL_LIB} TYPE LIB)

0 comments on commit 57248d2

Please sign in to comment.