:: commit 66e680cf44411835b91529aeae602c2e65e3c21a

Daniel Engberg <daniel.engberg.lists@pyret.net> — 2023-08-06 18:25

parents: e954b57125

CMake: Explicitly link with pthreads (#111)

Compilation fails on various platforms without -pthread and this is consistent behaviour with GNU Autotools build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3a0acf..4b9af3a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,6 +51,7 @@ target_include_directories(
   INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
 if(BZIP3_ENABLE_PTHREAD)
   target_compile_definitions(bz3 PUBLIC PTHREAD)
+  target_link_libraries(bz3 Threads::Threads)
 endif()
 if(BZIP3_ENABLE_ARCH_NATIVE)
   check_c_compiler_flag(-march=native CC_SUPPORT_MARCH_NATIVE_FLAG)
tab: 248 wrap: offon