lib: fix pthread linking with lld on MSYS2

This commit is contained in:
Steve Markgraf 2026-02-04 23:52:51 +01:00
parent 50e7a46f7f
commit 7ef220c7aa
2 changed files with 2 additions and 15 deletions

View file

@ -51,9 +51,6 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32)
ADD_DEFINITIONS(-Wsign-compare)
#http://gcc.gnu.org/wiki/Visibility
add_definitions(-fvisibility=hidden)
elseif(MSVC14 OR MSVC14)
#pthread-w32 issue, timespec is now part of time.h
ADD_DEFINITIONS(-D_TIMESPEC_DEFINED)
endif()
########################################################################
@ -117,14 +114,6 @@ endif()
find_package(CRCFAST)
if(MSVC)
set(THREADS_PTHREADS_LIBRARY "" CACHE STRING "manual pthread-win32 path")
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE STRING "manual pthread-win32 includepath")
else()
set(THREADS_PTHREADS_LIBRARY "" CACHE INTERNAL "manual pthread-win32 path")
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE INTERNAL "manual pthread-win32 includepath")
endif()
if(PKG_CONFIG_FOUND AND NOT LIBUSB_FOUND)
message(FATAL_ERROR "LibUSB 1.0 required to compile hsdaoh")
endif()

View file

@ -37,7 +37,7 @@ add_library(hsdaoh SHARED ${HSDAOH_COMMON_SOURCES})
target_link_libraries(hsdaoh
${LIBUSB_LIBRARIES}
${LIBUVC_LIBRARIES}
${THREADS_PTHREADS_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
)
if(CRCFAST_FOUND)
@ -52,7 +52,6 @@ target_include_directories(hsdaoh PUBLIC
$<INSTALL_INTERFACE:include> # <prefix>/include
${LIBUSB_INCLUDE_DIRS}
${LIBUVC_INCLUDE_DIRS}
${THREADS_PTHREADS_INCLUDE_DIR}
)
set_target_properties(hsdaoh PROPERTIES DEFINE_SYMBOL "hsdaoh_EXPORTS")
set_target_properties(hsdaoh PROPERTIES OUTPUT_NAME hsdaoh)
@ -69,7 +68,7 @@ target_link_libraries(hsdaoh_static
m
${LIBUSB_LIBRARIES}
${LIBUVC_LIBRARIES}
${THREADS_PTHREADS_LIBRARY}
${CMAKE_THREAD_LIBS_INIT}
)
if(CRCFAST_FOUND)
@ -84,7 +83,6 @@ target_include_directories(hsdaoh_static PUBLIC
$<INSTALL_INTERFACE:include> # <prefix>/include
${LIBUSB_INCLUDE_DIRS}
${LIBUVC_INCLUDE_DIRS}
${THREADS_PTHREADS_INCLUDE_DIR}
)
set_property(TARGET hsdaoh_static APPEND PROPERTY COMPILE_DEFINITIONS "hsdaoh_STATIC" )
set_property(TARGET hsdaoh_static PROPERTY POSITION_INDEPENDENT_CODE ON)