Skip to content

Commit

Permalink
[build] fix when openssl is static build fail
Browse files Browse the repository at this point in the history
  • Loading branch information
lilinxiong committed Dec 27, 2024
1 parent 8a89a3a commit 798fd4a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ option(ENABLE_CODE_COVERAGE "Enable code coverage reporting" OFF)
option(ENABLE_MONOTONIC_CLOCK "Enforced clock_gettime with monotonic clock on GC CV" ${ENABLE_MONOTONIC_CLOCK_DEFAULT})
option(ENABLE_STDCXX_SYNC "Use C++11 chrono and threads for timing instead of pthreads" ${ENABLE_STDCXX_SYNC_DEFAULT})
option(USE_OPENSSL_PC "Use pkg-config to find OpenSSL libraries" ON)
option(OPENSSL_USE_STATIC_LIBS "Link OpenSSL libraries statically." OFF)
option(USE_OPENSSL_STATIC_LIBS "Link OpenSSL libraries statically." OFF)
option(USE_BUSY_WAITING "Enable more accurate sending times at a cost of potentially higher CPU load" OFF)
option(USE_GNUSTL "Get c++ library/headers from the gnustl.pc" OFF)
option(ENABLE_SOCK_CLOEXEC "Enable setting SOCK_CLOEXEC on a socket" ON)
Expand Down Expand Up @@ -389,7 +389,7 @@ if (ENABLE_ENCRYPTION)
# fall back to find_package method otherwise
if (USE_OPENSSL_PC)
pkg_check_modules(SSL ${SSL_REQUIRED_MODULES})
if (OPENSSL_USE_STATIC_LIBS)
if (USE_OPENSSL_STATIC_LIBS)
# use `pkg-config --static xxx` found libs
set(SSL_LIBRARIES ${SSL_STATIC_LIBRARIES})
endif()
Expand Down Expand Up @@ -1079,7 +1079,7 @@ if (srt_libspec_shared)
if (MICROSOFT)
target_link_libraries(${TARGET_srt}_shared PRIVATE ws2_32.lib)
if (NOT (ENABLE_ENCRYPTION AND "${USE_ENCLIB}" STREQUAL "botan"))
if (OPENSSL_USE_STATIC_LIBS)
if (USE_OPENSSL_STATIC_LIBS)
target_link_libraries(${TARGET_srt}_shared PRIVATE crypt32.lib)
else()
set_target_properties(${TARGET_srt}_shared PROPERTIES LINK_FLAGS "/DELAYLOAD:libeay32.dll")
Expand Down Expand Up @@ -1118,7 +1118,7 @@ if (srt_libspec_static)
endif()
if (MICROSOFT)
target_link_libraries(${TARGET_srt}_static PRIVATE ws2_32.lib)
if (OPENSSL_USE_STATIC_LIBS)
if (USE_OPENSSL_STATIC_LIBS)
target_link_libraries(${TARGET_srt}_static PRIVATE crypt32.lib)
endif()
elseif (MINGW)
Expand All @@ -1132,7 +1132,7 @@ endif()
target_include_directories(srt_virtual PRIVATE ${SSL_INCLUDE_DIRS})

if (MICROSOFT)
if (OPENSSL_USE_STATIC_LIBS)
if (USE_OPENSSL_STATIC_LIBS)
set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ws2_32.lib crypt32.lib)
else()
set (SRT_LIBS_PRIVATE ${SRT_LIBS_PRIVATE} ws2_32.lib)
Expand Down Expand Up @@ -1174,7 +1174,7 @@ endif()
if (srt_libspec_shared)
if (MICROSOFT)
target_link_libraries(${TARGET_srt}_shared PUBLIC Ws2_32.lib)
if (OPENSSL_USE_STATIC_LIBS)
if (USE_OPENSSL_STATIC_LIBS)
target_link_libraries(${TARGET_srt}_shared PUBLIC crypt32.lib)
endif()
endif()
Expand Down

0 comments on commit 798fd4a

Please sign in to comment.