Commit e0267eb1 authored by Brad King's avatar Brad King
Browse files

FindThreads: Fix libc check to use proper header for pthread_kill

In commit e9a1ddc5 (FindThreads: Replace the pthread symbol checking
in libc., 2018-11-18, v3.14.0-rc1~292^2) we switched to checking for
`pthread_kill` in libc but did not update the symbol check's header file
to match.  Add `signal.h` to get `pthread_kill`.  Keep `pthread.h`
anyway since the purpose of the check is to verify that the pthread API
works.

Fixes: #18984
parent e6897c72
......@@ -125,8 +125,10 @@ if(CMAKE_HAVE_PTHREAD_H)
# libc(libasan). However, it doesn't have the full pthread implementation.
# So, we can't assume that we have the pthread implementation in libc
# using the pthread_create() checking here. Then, we turn to check the
# pthread_kill() symbol instead.
CHECK_SYMBOL_EXISTS(pthread_kill pthread.h CMAKE_HAVE_LIBC_PTHREAD_KILL)
# pthread_kill() symbol instead. It is in the "signal.h" header, but
# the purpose of this check is to verify that the pthread API works with
# pure libc, so verify that "pthread.h" can be included too.
CHECK_SYMBOL_EXISTS(pthread_kill "signal.h;pthread.h" CMAKE_HAVE_LIBC_PTHREAD_KILL)
if(CMAKE_HAVE_LIBC_PTHREAD_KILL)
set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment