Jelajahi Sumber

Merge topic 'FindThreads-msvc-no-pthread-flag' into release-3.24

7203963788 FindThreads: Skip check for -pthread flag when targeting the MSVC ABI

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !7551
Brad King 3 tahun lalu
induk
melakukan
425f6a0ef6
1 mengubah file dengan 5 tambahan dan 1 penghapusan
  1. 5 1
      Modules/FindThreads.cmake

+ 5 - 1
Modules/FindThreads.cmake

@@ -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)