Moved pthread non portable function checks before ASAN
@@ -347,6 +347,20 @@ if(NOT IOS)
find_package(Threads REQUIRED)
endif()
+if(NOT WIN32)
+ CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
+ if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
+ CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
+ endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
+ if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
+ CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
+ endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
+
+ if (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
+ set(HAVE_PTHREAD_MUTEX_TIMEDLOCK ON)
+ endif (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
+endif()
+
# Enable address sanitizer, where supported and when required
if(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCC)
CHECK_C_COMPILER_FLAG ("-fno-omit-frame-pointer" fno-omit-frame-pointer)
@@ -605,20 +619,6 @@ if(ANDROID)
endif(WITH_GPROF)
endif()
-if(NOT WIN32)
- CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
- if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
- CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
- endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
- if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
- CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
- endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
-
- if (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
- set(HAVE_PTHREAD_MUTEX_TIMEDLOCK ON)
- endif (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
-endif()
-
if(WITH_VALGRIND_MEMCHECK)
check_include_files(valgrind/memcheck.h HAVE_VALGRIND_MEMCHECK_H)
else()
