summaryrefslogtreecommitdiff
path: root/Modules/FindThreads.cmake
diff options
context:
space:
mode:
authorJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:01 +0900
committerJinWang An <jinwang.an@samsung.com>2022-12-27 17:20:01 +0900
commit39ffe0bb75b9a5a84ade197d469a816e80e2f4d5 (patch)
tree7f9b3d0b4b088b7b2f9f4246141aaa85cbbd9a2a /Modules/FindThreads.cmake
parent62fb436c87cb6ac30a448a2933b9febff4cf1661 (diff)
downloadcmake-39ffe0bb75b9a5a84ade197d469a816e80e2f4d5.tar.gz
cmake-39ffe0bb75b9a5a84ade197d469a816e80e2f4d5.tar.bz2
cmake-39ffe0bb75b9a5a84ade197d469a816e80e2f4d5.zip
Imported Upstream version 3.21.5upstream/3.21.5
Diffstat (limited to 'Modules/FindThreads.cmake')
-rw-r--r--Modules/FindThreads.cmake19
1 files changed, 11 insertions, 8 deletions
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index c6a3451f7..ffd3352f9 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -164,18 +164,21 @@ if(CMAKE_HAVE_PTHREAD_H)
elseif(CMAKE_CXX_COMPILER_LOADED)
CHECK_CXX_SOURCE_COMPILES("${PTHREAD_C_CXX_TEST_SOURCE}" CMAKE_HAVE_LIBC_PTHREAD)
endif()
- if(CMAKE_HAVE_LIBC_PTHREAD)
+
+ # 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)
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()