diff --git a/software/src/CMakeLists.txt b/software/src/CMakeLists.txt index d137251..293162e 100644 --- a/software/src/CMakeLists.txt +++ b/software/src/CMakeLists.txt @@ -97,14 +97,21 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") endif() endif() - FetchContent_Declare( - pthreads4w - GIT_REPOSITORY "https://github.com/GerHobbelt/pthread-win32" - OVERRIDE_FIND_PACKAGE - EXCLUDE_FROM_ALL - ) - find_package(pthreads4w CONFIG REQUIRED) - set(LIBTHREAD pthreads4w::pthreadVC3) + if(MSVC) + # MSVC has no native POSIX threads; use pthreads4w + FetchContent_Declare( + pthreads4w + GIT_REPOSITORY "https://github.com/GerHobbelt/pthread-win32" + OVERRIDE_FIND_PACKAGE + EXCLUDE_FROM_ALL + ) + find_package(pthreads4w CONFIG REQUIRED) + set(LIBTHREAD pthreads4w::pthreadVC3) + else() + # MinGW/MSYS2 ships with winpthreads; use native threads + find_package(Threads REQUIRED) + set(LIBTHREAD Threads::Threads) + endif() set(LIBMATH "") # No separate math library needed on Windows else()