summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-03-01 13:37:53 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-03-01 13:37:58 (GMT)
commit893ba6c5c3db15835edd1c35ccf2e8cc5fd2fa29 (patch)
tree204a813b371e9218eae756175efe20c73612242d /Modules
parent07a7772968a17e804fc7c450a0a3a00a7203410d (diff)
parentc6da90bd39f3e03ba6a2a4cfac0d179e04e0b236 (diff)
downloadCMake-893ba6c5c3db15835edd1c35ccf2e8cc5fd2fa29.zip
CMake-893ba6c5c3db15835edd1c35ccf2e8cc5fd2fa29.tar.gz
CMake-893ba6c5c3db15835edd1c35ccf2e8cc5fd2fa29.tar.bz2
Merge topic 'FindThreads-revert-libc-pthread-flag' into release-3.23
c6da90bd39 FindThreads: Revert "Honor THREADS_PREFER_PTHREAD_FLAG when ... in libc" Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7025
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindThreads.cmake19
1 files changed, 8 insertions, 11 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 4198374..e4d6cf3 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -164,21 +164,18 @@ if(CMAKE_HAVE_PTHREAD_H)
elseif(CMAKE_CXX_COMPILER_LOADED)
CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
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)
- _check_pthreads_flag()
- endif()
-
- if(Threads_FOUND)
- # do nothing, we are done
- elseif(CMAKE_HAVE_LIBC_PTHREAD)
+ if(CMAKE_HAVE_LIBC_PTHREAD)
set(CMAKE_THREAD_LIBS_INIT "")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
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)
+ _check_pthreads_flag()
+ endif ()
+
if(CMAKE_SYSTEM MATCHES "GHS-MULTI")
_check_threads_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE)
endif()