Skip to content

Commit

Permalink
Append pthread to platform libs if cmake found Thread library does no…
Browse files Browse the repository at this point in the history
…t provide required symbol (#897)

Co-authored-by: Sergey Ryabinin <[email protected]>
  • Loading branch information
SergeyRyabinin and Sergey Ryabinin authored Mar 31, 2022
1 parent 1a8e29b commit 68f28f8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,15 @@ else ()

if (UNIX OR APPLE)
find_package(Threads REQUIRED)
endif ()

if (NOT ANDROID AND NOT CMAKE_THREAD_LIBS_INIT)
check_symbol_exists(pthread_mutexattr_init "<pthread.h>" HAVE_PTHREAD_MUTEXATTR_INIT)
if (NOT HAVE_PTHREAD_MUTEXATTR_INIT)
# fsanitize=... results in GLIBC library to provide some pthread APIs but not all
list(APPEND PLATFORM_LIBS pthread)
endif()
endif()
endif()

if (APPLE)
# Don't add the exact path to CoreFoundation as this would hardcode the SDK version
Expand Down

0 comments on commit 68f28f8

Please sign in to comment.