diff --git a/CMakeLists.txt b/CMakeLists.txt index 625c2ae6c..1a1c79707 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,12 +36,21 @@ find_package(Libusb1) find_package(JPEG) find_package(realsense2 CONFIG) find_package(SDL2 CONFIG) -find_package(Threads) find_package(ZLIB) find_package(cJSON) find_package(Systemd) find_package(OpenGLES COMPONENTS V3) +add_library(xrt-pthreads INTERFACE) +if(WIN32) + find_package(pthreads_windows REQUIRED) + target_link_libraries(xrt-pthreads INTERFACE PThreads4W::PThreads4W_CXXEXC) +else() + set(CMAKE_THREAD_PREFER_PTHREAD ON) + find_package(Threads) + target_link_libraries(xrt-pthreads INTERFACE Threads::Threads) +endif() + if(NOT ANDROID) # @TODO Turn into a find_package LIBUVC file. pkg_check_modules(LIBUVC libuvc) diff --git a/src/xrt/auxiliary/CMakeLists.txt b/src/xrt/auxiliary/CMakeLists.txt index e99449f87..2c03a397f 100644 --- a/src/xrt/auxiliary/CMakeLists.txt +++ b/src/xrt/auxiliary/CMakeLists.txt @@ -156,7 +156,7 @@ endif() # OS library. add_library(aux_os STATIC ${OS_SOURCE_FILES}) -target_link_libraries(aux_os PUBLIC aux-includes PRIVATE Threads::Threads) +target_link_libraries(aux_os PUBLIC aux-includes xrt-pthreads) if(XRT_HAVE_DBUS) target_link_libraries(aux_os PRIVATE ${DBUS_LIBRARIES}) target_include_directories(aux_os SYSTEM