diff options
author | Brad King <brad.king@kitware.com> | 2022-04-14 13:13:04 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-04-26 13:54:53 -0400 |
commit | 564385194b53b656fc9d010329575ca957569401 (patch) | |
tree | 48389b04b00e170e2dc9b22e0e115112cc9ace5d | |
parent | 41ef904e81a6ef6758b3b9ccf29b69c784cf67b7 (diff) | |
download | cmake-564385194b53b656fc9d010329575ca957569401.tar.gz |
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.
-rw-r--r-- | Modules/FindThreads.cmake | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index 52a8a5f3eb..fb99094951 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) |