From 564385194b53b656fc9d010329575ca957569401 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 14 Apr 2022 13:13:04 -0400 Subject: FindThreads: Avoid repeating check for -pthread flag When `THREADS_PREFER_PTHREAD_FLAG` is enabled, we check for it before the thread libraries. We do not need to check after them too. --- Modules/FindThreads.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 52a8a5f..fb99094 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -180,7 +180,9 @@ if(CMAKE_HAVE_PTHREAD_H) _threads_check_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) _threads_check_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) - _threads_check_flag_pthread() + if (NOT THREADS_PREFER_PTHREAD_FLAG) + _threads_check_flag_pthread() + endif() endif() if(CMAKE_THREAD_LIBS_INIT OR CMAKE_HAVE_LIBC_PTHREAD) -- cgit v0.12