CMake: Link Threads the old-style

If linked against Threads::Threads target while building static libraries, cmake cannot find the
threads library while trying to use the installed target afterwards
This commit is contained in:
Furkan Usta
2020-04-29 23:47:36 +03:00
parent eee07e6cfd
commit 44b06d70e8
+3 -1
View File
@@ -73,7 +73,9 @@ endif()
option(SIMDJSON_ENABLE_THREADS "Enable threaded operation" ON)
if(SIMDJSON_ENABLE_THREADS)
find_package(Threads REQUIRED)
target_link_libraries(simdjson-flags INTERFACE Threads::Threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
target_link_libraries(simdjson-flags INTERFACE ${CMAKE_THREAD_LIBS_INIT} )
endif()
option(SIMDJSON_SANITIZE "Sanitize addresses" OFF)