Skip to content

Commit

Permalink
Link tests against pthreads
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Sep 28, 2023
1 parent b0d5b56 commit 06c03c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ if (BUILD_TESTING)
endforeach()
endif()

# clang-10 does not link pthreads by default, which is needed by std::thread in the tests
find_package(Threads REQUIRED)

file(GLOB_RECURSE testSources "${CMAKE_CURRENT_SOURCE_DIR}/tests/**")
add_executable(tests ${testSources})
catch_discover_tests(tests)
Expand Down Expand Up @@ -126,7 +129,7 @@ if (BUILD_TESTING)
target_compile_options(tests PRIVATE -Wno-dangling-reference) # triggered by an access involving RecordRef, so basically everywhere
endif()
endif()
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain llama::llama)
target_link_libraries(tests PRIVATE Catch2::Catch2WithMain Threads::Threads llama::llama)

option(LLAMA_ENABLE_ASAN_FOR_TESTS "Enables address sanitizer for tests" OFF)
if (LLAMA_ENABLE_ASAN_FOR_TESTS)
Expand Down

0 comments on commit 06c03c2

Please sign in to comment.