mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 00:11:07 -06:00
FindThreads: Fix libc check to use proper header for pthread_kill
In commit e9a1ddc594 (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
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user