summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-02-26 07:46:26 -0500
committerBrad King <brad.king@kitware.com>2019-02-26 07:51:52 -0500
commite0267eb1d327befd9839c0d745c84e6550618104 (patch)
treec69732a5f8d425ee253828d2490ad19c4d358cb3
parente6897c72e7c59f7a0b82ed19c1bdb40d42f7adaa (diff)
downloadcmake-e0267eb1d327befd9839c0d745c84e6550618104.tar.gz
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
-rw-r--r--Modules/FindThreads.cmake6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 5d894c8623..a2f3fa3017 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -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)