Fixed bug 3688 - cmake / pthread check related patch proposal

Juha Niemim?ki

Fix for PTHREAD_MUTEX_RECURSIVE_NP check and restoring the original flags

Two fixes proposed:

1) Looks like there is a copy-paste issue regarding PTHREAD_MUTEX_RECURSIVE_NP check.

2) Compiler flag restoration doesn't look symmetrical regarding if/endif blocks. Moved to an outer block (if PTHREADS).
This commit is contained in:
Sam Lantinga 2017-07-10 18:40:35 -07:00
parent 3c09265daf
commit 34b29c6ac5
1 changed files with 2 additions and 2 deletions

View File

@ -931,7 +931,7 @@ macro(CheckPTHREAD)
#include <pthread.h>
int main(int argc, char **argv) {
pthread_mutexattr_t attr;
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
return 0;
}" HAVE_RECURSIVE_MUTEXES_NP)
if(HAVE_RECURSIVE_MUTEXES_NP)
@ -960,7 +960,6 @@ macro(CheckPTHREAD)
int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
set(SOURCE_FILES ${SOURCE_FILES}
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
@ -977,6 +976,7 @@ macro(CheckPTHREAD)
endif()
set(HAVE_SDL_THREADS TRUE)
endif()
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
endif()
endmacro()