Skip to content

Commit

Permalink
Add find_package for OpenSSL to cmake build.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcnamara committed Jul 2, 2021
1 parent ee50742 commit 2d849f0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,11 @@ if(NOT USE_OPENSSL_MD5 AND NOT USE_NO_MD5)
endif()

if(USE_OPENSSL_MD5)
set(LIB_CRYPTO "crypto")
find_package(OpenSSL REQUIRED)
if(OpenSSL_FOUND)
include_directories(${OPENSSL_INCLUDE_DIR})
message(STATUS "OpenSSL version: ${OPENSSL_VERSION}")
endif()
endif()

set(LXW_PROJECT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
Expand All @@ -264,7 +268,7 @@ target_sources(${PROJECT_NAME}
PRIVATE ${LXW_SOURCES}
PUBLIC ${LXW_HEADERS}
)
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO})
target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY})
target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS})

# /utf-8 needs VS2015 Update 2 or above.
Expand Down

0 comments on commit 2d849f0

Please sign in to comment.