]> granicus.if.org Git - libevent/commitdiff
cmake: Fix Android build.
authorRyan Pavlik <ryan.pavlik@collabora.com>
Mon, 3 Oct 2022 14:31:10 +0000 (09:31 -0500)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sat, 8 Oct 2022 16:27:21 +0000 (19:27 +0300)
Android/Bionic C library needs no special flags to have threading support.
Found when trying to build with vcpkg.

CMakeLists.txt

index 20bdc92e064791f3f97cbcdb3f60f17aeedc91eb..4efe834e6031a274b2f95b436e8ce8a8db878de8 100644 (file)
@@ -556,6 +556,11 @@ endif()
 if (NOT EVENT__DISABLE_THREAD_SUPPORT)
     if (WIN32)
         list(APPEND SRC_CORE evthread_win32.c)
+    elseif(ANDROID)
+        # pthreads is built in to bionic
+        set(EVENT__HAVE_PTHREADS 1)
+        CHECK_TYPE_SIZE(pthread_t EVENT__SIZEOF_PTHREAD_T)
+        list(APPEND SYMBOLS_TO_CHECK pthread_mutexattr_setprotocol)
     else()
         find_package(Threads REQUIRED)
         if (NOT CMAKE_USE_PTHREADS_INIT)