build: Be able to build against pthreads4w

This commit is contained in:
Ryan Pavlik 2020-07-15 20:11:05 -07:00 committed by Jakob Bornecrantz
parent 7e600dd244
commit 6ad46cb1b2
2 changed files with 11 additions and 2 deletions

View file

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

View file

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