From 34b29c6ac50ea113361c06246cc25848dbb0b088 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 10 Jul 2017 18:40:35 -0700 Subject: [PATCH] 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). --- cmake/sdlchecks.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake index 3187b5bd4..770378828 100644 --- a/cmake/sdlchecks.cmake +++ b/cmake/sdlchecks.cmake @@ -931,7 +931,7 @@ macro(CheckPTHREAD) #include 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()