Fix pthread detection for regress tests on Android

Fixes: #1403
This commit is contained in:
Azat Khuzhin 2023-01-28 13:28:52 +01:00
parent 35375101e7
commit 4d85d28acd

View File

@ -556,6 +556,7 @@ else()
endif()
endif()
set(PTHREADS_AVAILABLE OFF)
if (NOT EVENT__DISABLE_THREAD_SUPPORT)
if (WIN32)
list(APPEND SRC_CORE evthread_win32.c)
@ -564,12 +565,14 @@ if (NOT EVENT__DISABLE_THREAD_SUPPORT)
set(EVENT__HAVE_PTHREADS 1)
CHECK_TYPE_SIZE(pthread_t EVENT__SIZEOF_PTHREAD_T)
list(APPEND SYMBOLS_TO_CHECK pthread_mutexattr_setprotocol)
set(PTHREADS_AVAILABLE ON)
else()
find_package(Threads REQUIRED)
if (NOT CMAKE_USE_PTHREADS_INIT)
message(FATAL_ERROR
"Failed to find Pthreads, set EVENT__DISABLE_THREAD_SUPPORT to disable")
endif()
set(PTHREADS_AVAILABLE ON)
set(EVENT__HAVE_PTHREADS 1)
list(APPEND LIB_APPS ${CMAKE_THREAD_LIBS_INIT})
@ -1294,7 +1297,7 @@ if (NOT EVENT__DISABLE_TESTS)
if (NOT EVENT__DISABLE_MBEDTLS)
target_link_libraries(regress event_mbedtls)
endif()
if (CMAKE_USE_PTHREADS_INIT)
if (PTHREADS_AVAILABLE)
target_link_libraries(regress event_pthreads)
endif()
else()