aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorAurelien Jarno <aurel32@debian.org>2021-10-14 00:00:00 +0000
committerVasyl Gello <vasek.gello@gmail.com>2021-10-18 21:34:02 +0000
commit53d7223d27c188e5dfecf235edeb7f1383edd1dc (patch)
tree6a1d21bfbdde85b895d55c8dd4c29bda3fb60fe3 /CMakeLists.txt
parenta1396591299c85ac53ea86a06dccddc73e166d06 (diff)
Properly link with -pthread instead of -lpthread
This patch changes the way cmake handles Thread support to correctly link with -pthread instead of -lpthread. That way GCC automatically pulls in -latomic if needed. I have noticed that debian/rules already forces LDFLAGS to contain -latomic, however it appears too early in the linker command to be early (it needs to be after the objects needing this library).
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt1
1 files changed, 1 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0117bf3b2d..2f6f1c3ae0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -105,6 +105,7 @@ if (NOT PLATFORMDEFS_DIR STREQUAL "")
endif()
find_package(PkgConfig)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED QUIET)
list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT})