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