cmake: fix detection of pthread_setname_np() on Apple platforms.

Ozkan Sezer 2023-02-13 11:55:40 +03:00
parent 93ed3148ba
commit f7f61af12b
1 changed files with 4 additions and 0 deletions

View File

@ -872,7 +872,11 @@ macro(CheckPTHREAD)
check_c_source_compiles(" check_c_source_compiles("
#include <pthread.h> #include <pthread.h>
int main(int argc, char **argv) { int main(int argc, char **argv) {
#ifdef __APPLE__
pthread_setname_np(pthread_self());
#else
pthread_setname_np(pthread_self(), \"\"); pthread_setname_np(pthread_self(), \"\");
#endif
return 0; return 0;
}" HAVE_PTHREAD_SETNAME_NP) }" HAVE_PTHREAD_SETNAME_NP)
if (HAVE_PTHREAD_NP_H) if (HAVE_PTHREAD_NP_H)