From 2bd91ae751e4713920ff810959b5f91ef2c957ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Wed, 16 Jul 2025 20:02:25 +0200 Subject: [PATCH] link with threads --- CMakeLists.txt | 4 ++-- test/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 47052f3..2fd6b3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,8 +15,8 @@ set(CMAKE_C_STANDARD 99) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wundef -Wcast-qual -Wshadow -Wcast-align -pipe -Wno-unused-parameter -Werror=implicit-function-declaration -Winit-self -pthread") add_definitions(-D_FILE_OFFSET_BITS=64) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -O2 -pthread") - - +set(THREADS_PREFER_PTHREAD_FLAG ON) +find_package(Threads REQUIRED) option(CODE_COVERAGE "build with code coverage intrumentation" OFF) if (CODE_COVERAGE) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 097d604..6b3e795 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,7 +8,7 @@ else() target_link_libraries(rt) endif() add_executable(test_runner ${TEST_SOURCE_FILES}) -target_link_libraries(test_runner check ucore) +target_link_libraries(test_runner check ucore PRIVATE Threads::Threads) add_custom_target(test COMMAND test_runner DEPENDS test_runner