diff options
author | Brad King <brad.king@kitware.com> | 2022-04-14 17:10:30 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-04-26 17:54:53 (GMT) |
commit | 41ef904e81a6ef6758b3b9ccf29b69c784cf67b7 (patch) | |
tree | 83244f7bbe308d061200944fe1e2dd325b49d20a /Modules/FindThreads.cmake | |
parent | cbe7550d998def869d297b2bf6e3d9b8689e33de (diff) | |
download | CMake-41ef904e81a6ef6758b3b9ccf29b69c784cf67b7.zip CMake-41ef904e81a6ef6758b3b9ccf29b69c784cf67b7.tar.gz CMake-41ef904e81a6ef6758b3b9ccf29b69c784cf67b7.tar.bz2 |
FindThreads: Simplify conditions for not-in-libc checks
If `CMAKE_HAVE_LIBC_PTHREAD` is true, we also set `Threads_FOUND` to
true, which blocks all the other checks from running.
Diffstat (limited to 'Modules/FindThreads.cmake')
-rw-r--r-- | Modules/FindThreads.cmake | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake index ed0bb8b..52a8a5f 100644 --- a/Modules/FindThreads.cmake +++ b/Modules/FindThreads.cmake @@ -165,21 +165,21 @@ if(CMAKE_HAVE_PTHREAD_H) if(CMAKE_HAVE_LIBC_PTHREAD) set(CMAKE_THREAD_LIBS_INIT "") set(Threads_FOUND TRUE) - else() - # Check for -pthread first if enabled. This is the recommended - # way, but not backwards compatible as one must also pass -pthread - # as compiler flag then. - if (THREADS_PREFER_PTHREAD_FLAG) - _threads_check_flag_pthread() - endif () - - if(CMAKE_SYSTEM MATCHES "GHS-MULTI") - _threads_check_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE) - endif() - _threads_check_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) - _threads_check_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) endif() + # Check for -pthread first if enabled. This is the recommended + # way, but not backwards compatible as one must also pass -pthread + # as compiler flag then. + if (THREADS_PREFER_PTHREAD_FLAG) + _threads_check_flag_pthread() + endif () + + if(CMAKE_SYSTEM MATCHES "GHS-MULTI") + _threads_check_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE) + endif() + _threads_check_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE) + _threads_check_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE) + _threads_check_flag_pthread() endif() |