Link libsyncthing to pthread library via `-pthread`

That's preferred over just specifying the library path because it invokes
additional behavior like adding `-D_REENTRANT` which might be required.
This commit is contained in:
Martchus 2021-10-04 19:21:18 +02:00
parent 55e59d20c0
commit 567e176d48
1 changed files with 4 additions and 1 deletions

View File

@ -214,7 +214,10 @@ set_property(TARGET syncthinginternal PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${
if (WIN32)
set(SYNCTHING_INTERNAL_LIBS ws2_32 winmm)
elseif (UNIX)
set(SYNCTHING_INTERNAL_LIBS pthread)
set_property(
TARGET syncthinginternal
APPEND
PROPERTY INTERFACE_LINK_OPTIONS "-pthread")
endif ()
foreach (LIBRARY ${SYNCTHING_INTERNAL_LIBS})
find_library(SYNCTHING_INTERNAL_LIBRARY_PATH_${LIBRARY} ${LIBRARY})