Skip to content

Commit

Permalink
Fix pthread detection for regress tests on Android
Browse files Browse the repository at this point in the history
Fixes: #1403
  • Loading branch information
azat committed Jan 28, 2023
1 parent 3537510 commit 4d85d28
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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})
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4d85d28

Please sign in to comment.