Move find_dependency() directly to LibeventConfig.cmake (#1726)

This commit is contained in:
Azat Khuzhin 2024-10-04 06:45:52 +03:00 committed by GitHub
commit f6e426c299
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 9 deletions

View File

@ -1099,9 +1099,6 @@ if (EVENT__HAVE_OPENSSL)
INNER_LIBRARIES event_core
LIBRARIES ${OPENSSL_TARGETS}
SOURCES ${SRC_OPENSSL})
set(LIBEVENT_OPENSSL_DEPENDENCY "find_dependency(OpenSSL)")
else ()
set(LIBEVENT_OPENSSL_DEPENDENCY "")
endif()
if (EVENT__HAVE_MBEDTLS)
@ -1109,9 +1106,6 @@ if (EVENT__HAVE_MBEDTLS)
INNER_LIBRARIES event_core
LIBRARIES ${MBEDTLS_TARGETS}
SOURCES ${SRC_MBEDTLS})
set(LIBEVENT_MBEDTLS_DEPENDENCY "find_dependency(MbedTLS)")
else ()
set(LIBEVENT_MBEDTLS_DEPENDENCY "")
endif()
if (EVENT__HAVE_PTHREADS)

View File

@ -40,8 +40,12 @@ set(LIBEVENT_VERSION @EVENT_PACKAGE_VERSION@)
# by component.
include(CMakeFindDependencyMacro)
find_dependency(Threads)
@LIBEVENT_MBEDTLS_DEPENDENCY@
@LIBEVENT_OPENSSL_DEPENDENCY@
if(@EVENT__HAVE_MBEDTLS@)
find_dependency(MbedTLS)
endif()
if(@EVENT__HAVE_OPENSSL@)
find_dependency(OpenSSL)
endif()
# IMPORTED targets from LibeventTargets.cmake
set(LIBEVENT_STATIC_LIBRARIES "@LIBEVENT_STATIC_LIBRARIES@")
@ -57,7 +61,7 @@ if(${LIBEVENT_STATIC_LINK})
set(_AVAILABLE_LIBS "${LIBEVENT_STATIC_LIBRARIES}")
# CMake before 3.15 doesn't link OpenSSL to pthread/dl, do it ourselves instead
if (${CMAKE_VERSION} VERSION_LESS "3.15.0" AND ${LIBEVENT_STATIC_LINK} AND ${OPENSSL_FOUND} AND ${Threads_FOUND})
if (${CMAKE_VERSION} VERSION_LESS "3.15.0" AND "${LIBEVENT_STATIC_LINK}" AND "${OPENSSL_FOUND}" AND "${Threads_FOUND}")
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads)
set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
endif ()