From 279400845bf1c3f9353f878f9bbf935b6689d944 Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Wed, 15 Mar 2023 19:36:16 +0300 Subject: [PATCH] CMake: properly find and link to threading library --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ca3be38a5..3134e5847 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,11 @@ if (NOT MSVC) endif() endif() +include(FindThreads) +if (NOT Threads_FOUND) + message(FATAL_ERROR "Threading library is not found") +endif() + if (APPLE AND NOT LLAMA_NO_ACCELERATE) find_library(ACCELERATE_FRAMEWORK Accelerate) if (ACCELERATE_FRAMEWORK) @@ -124,5 +129,5 @@ target_compile_definitions(quantize PUBLIC ${LLAMA_EXTRA_FLAGS}) target_link_libraries(ggml PRIVATE ${LLAMA_EXTRA_LIBS}) target_include_directories(ggml PUBLIC .) -target_link_libraries(quantize PRIVATE ggml) -target_link_libraries(llama PRIVATE ggml) +target_link_libraries(quantize PRIVATE ggml Threads::Threads) +target_link_libraries(llama PRIVATE ggml Threads::Threads)