From 2deec335f642285235bb1b444a0877947a0501b9 Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Thu, 3 Sep 2020 18:22:27 +0200 Subject: [PATCH] Add pthreads to link libraries, not link flags This fixes linking errors with --as-needed like: ld: libobjc.so.4.6: undefined reference to `pthread_mutexattr_destroy' Fixes #180 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7c33aa..8ac86a1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -353,7 +353,7 @@ endif() # threading implementation (we do for everything except thread-local storage) set(CMAKE_THREAD_PREFER_PTHREAD) include(FindThreads) -set(objc_LINK_FLAGS "${objc_LINK_FLAGS} ${CMAKE_THREAD_LIBS_INIT}") +target_link_libraries(objc Threads::Threads)