mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 13:51:33 -06:00
FindThreads: Skip check for -pthread flag when targeting the MSVC ABI
Since commit 3257c34073 (FindThreads: avoid failing in AIX when using
-D_XOPEN_SOURCE=500, 2022-04-30, v3.24.0-rc1~197^2) we no longer check
for `pthreads.h` before checking for the `-pthread` flag. Compilers
targeting the MSVC ABI do not have such a flag, so avoid performing the
check unnecessarily.
Fixes: #23829
This commit is contained in:
@@ -122,7 +122,11 @@ endmacro()
|
||||
macro(_threads_check_flag_pthread)
|
||||
if(NOT Threads_FOUND)
|
||||
# If we did not find -lpthreads, -lpthread, or -lthread, look for -pthread
|
||||
if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
|
||||
# except on compilers known to not have it.
|
||||
if(MSVC)
|
||||
# Compilers targeting the MSVC ABI do not have a -pthread flag.
|
||||
set(THREADS_HAVE_PTHREAD_ARG FALSE)
|
||||
elseif(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
|
||||
message(CHECK_START "Check if compiler accepts -pthread")
|
||||
if(CMAKE_C_COMPILER_LOADED)
|
||||
set(_threads_src ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c)
|
||||
|
||||
Reference in New Issue
Block a user