Browse Source

cmake: Fix broken pthread detection on Windows with CMake 3.24

Workaround for CMake issue
https://gitlab.kitware.com/cmake/cmake/-/issues/23829
PatTheMav 3 years ago
parent
commit
61f862d826
1 changed files with 6 additions and 0 deletions
  1. 6 0
      cmake/Modules/CompilerConfig.cmake

+ 6 - 0
cmake/Modules/CompilerConfig.cmake

@@ -15,6 +15,12 @@ if(OS_WINDOWS AND MSVC)
     )
   endif()
 
+  # CMake 3.24 introduces a bug mistakenly interpreting MSVC as supporting
+  # `-pthread`
+  if(${CMAKE_VERSION} VERSION_EQUAL "3.24.0")
+    set(THREADS_HAVE_PTHREAD_ARG OFF)
+  endif()
+
   # Check for Win SDK version 10.0.20348 or above
   obs_status(
     STATUS "Windows API version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")