mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Merge pull request #379 from andrassmuk/fix/issue-378-mingw-pthread
fix: use native winpthreads for MinGW/MSYS2 Windows builds
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user