build: use pthread cflags/ldflags
authorFelix Fietkau <nbd@nbd.name>
Tue, 21 Sep 2021 17:41:09 +0000 (19:41 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 21 Sep 2021 17:41:11 +0000 (19:41 +0200)
Fixes build on glibc

Signed-off-by: Felix Fietkau <nbd@nbd.name>
CMakeLists.txt

index bb96cab8f05b8ff8e8e432de702628bf1a2c55a3..dd5ad4a7e822fe8cb54e31c52d6aec61937758f6 100644 (file)
@@ -2,10 +2,13 @@ cmake_minimum_required(VERSION 3.12)
 
 PROJECT(ustp C)
 
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads)
+
 ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations -Wno-error=missing-declarations -I${CMAKE_SOURCE_DIR})
 
 ADD_EXECUTABLE(ustpd bridge_track.c brmon.c hmac_md5.c libnetlink.c mstp.c netif_utils.c packet.c worker.c config.c main.c ubus.c)
-TARGET_LINK_LIBRARIES(ustpd ubox ubus)
+TARGET_LINK_LIBRARIES(ustpd ubox ubus Threads::Threads)
 
 SET(CMAKE_INSTALL_PREFIX /)