mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
FindOpenSSL: Search for -pthread flag
Because -pthread doesn't begin with -l, it doesn't show up in the pkgconfig LIBRARIES variable, causing FindOpenSSL to not add the Threads::Threads dependency. Explicitly search LDFLAGS_EXTRA for -pthread and add the dependency if it's found. Fixes: #24532
This commit is contained in:
@@ -120,12 +120,13 @@ macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
|
||||
unset(_OpenSSL_has_dependency_zlib)
|
||||
if(OPENSSL_USE_STATIC_LIBS)
|
||||
set(_OpenSSL_libs "${_OPENSSL_STATIC_LIBRARIES}")
|
||||
set(_OpenSSL_ldflags_other "${_OPENSSL_STATIC_LDFLAGS_OTHER}")
|
||||
else()
|
||||
set(_OpenSSL_libs "${_OPENSSL_LIBRARIES}")
|
||||
set(_OpenSSL_ldflags_other "${_OPENSSL_LDFLAGS_OTHER}")
|
||||
endif()
|
||||
if(_OpenSSL_libs)
|
||||
unset(_OpenSSL_has_dependency_dl)
|
||||
unset(_OpenSSL_has_dependency_threads)
|
||||
foreach(_OPENSSL_DEP_LIB IN LISTS _OpenSSL_libs)
|
||||
if (_OPENSSL_DEP_LIB STREQUAL "ssl" OR _OPENSSL_DEP_LIB STREQUAL "crypto")
|
||||
# ignoring: these are the targets
|
||||
@@ -141,10 +142,22 @@ macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
|
||||
unset(_OPENSSL_DEP_LIB)
|
||||
else()
|
||||
set(_OpenSSL_has_dependency_dl TRUE)
|
||||
endif()
|
||||
if(_OpenSSL_ldflags_other)
|
||||
unset(_OpenSSL_has_dependency_threads)
|
||||
foreach(_OPENSSL_DEP_LDFLAG IN LISTS _OpenSSL_ldflags_other)
|
||||
if (_OPENSSL_DEP_LDFLAG STREQUAL "-pthread")
|
||||
set(_OpenSSL_has_dependency_threads TRUE)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
endforeach()
|
||||
unset(_OPENSSL_DEP_LDFLAG)
|
||||
else()
|
||||
set(_OpenSSL_has_dependency_threads TRUE)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
unset(_OpenSSL_libs)
|
||||
unset(_OpenSSL_ldflags_other)
|
||||
else()
|
||||
set(_OpenSSL_has_dependencies FALSE)
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user