diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake index e35f5ddbb3db9..b13bbe1f99a20 100644 --- a/src/libraries/Native/Unix/configure.cmake +++ b/src/libraries/Native/Unix/configure.cmake @@ -60,7 +60,7 @@ endif() # Older CMake versions (3.8) do not assign the result of their tests, causing unused-value errors # which are not distinguished from the test failing. So no error for that one. # For clang-5.0 avoid errors like "unused variable 'err' [-Werror,-Wunused-variable]". -set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wno-error=unused-value -Wno-error=unused-variable") +set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wno-error=unused-value -Wno-error=unused-variable -Wno-error=builtin-requires-header") # Apple platforms like macOS/iOS allow targeting older operating system versions with a single SDK, # the mere presence of a symbol in the SDK doesn't tell us whether the deployment target really supports it. @@ -671,7 +671,16 @@ check_symbol_exists( time.h HAVE_CLOCK_GETTIME_NSEC_NP) -check_library_exists(pthread pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK) +check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD) +check_library_exists(c pthread_create "" HAVE_PTHREAD_IN_LIBC) + +if (HAVE_LIBPTHREAD) + set(PTHREAD_LIBRARY pthread) +elseif (HAVE_PTHREAD_IN_LIBC) + set(PTHREAD_LIBRARY c) +endif() + +check_library_exists(${PTHREAD_LIBRARY} pthread_condattr_setclock "" HAVE_PTHREAD_CONDATTR_SETCLOCK) check_symbol_exists( futimes