From e1e12652e0cbabd892ba0a0eca3fb85926eb47a1 Mon Sep 17 00:00:00 2001 From: Jonathan GUILLOT Date: Tue, 27 Aug 2024 17:52:27 +0200 Subject: [PATCH] Retrieve pthread library using CMake FindThreads --- gpio/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gpio/CMakeLists.txt b/gpio/CMakeLists.txt index b8934ef..c69a747 100644 --- a/gpio/CMakeLists.txt +++ b/gpio/CMakeLists.txt @@ -6,6 +6,8 @@ project(gpio) find_package(PkgConfig REQUIRED) pkg_check_modules(libcrypt REQUIRED IMPORTED_TARGET) +find_package(Threads REQUIRED) + # Source files set(SRC gpio.c @@ -23,7 +25,7 @@ find_library(WIRINGPI_LIB wiringPi) find_library(WIRINGPI_DEV_LIB wiringPiDev) # Link the required libraries -target_link_libraries(gpio ${WIRINGPI_LIB} ${WIRINGPI_DEV_LIB} pthread rt m PkgConfig::libcrypt) +target_link_libraries(gpio ${WIRINGPI_LIB} ${WIRINGPI_DEV_LIB} Threads::Threads m PkgConfig::libcrypt) # Install the executable install(TARGETS gpio DESTINATION bin)