Skip to content

Commit

Permalink
Fixed bug 3688 - cmake / pthread check related patch proposal
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
slouken committed Jul 11, 2017
1 parent 3c09265 commit 34b29c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmake/sdlchecks.cmake
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -977,6 +976,7 @@ macro(CheckPTHREAD)
endif()
set(HAVE_SDL_THREADS TRUE)
endif()
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
endif()
endmacro()

Expand Down

0 comments on commit 34b29c6

Please sign in to comment.