1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Tue, 3 Aug 2021 15:12:51 +0200
Subject: Properly link against pthread
Forwarded: not-needed
---
Source/cmake_core.cmake | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/Source/cmake_core.cmake b/Source/cmake_core.cmake
index ade158e..a95362c 100644
--- a/Source/cmake_core.cmake
+++ b/Source/cmake_core.cmake
@@ -22,6 +22,9 @@ project(${ASTC_TARGET})
set(GNU_LIKE "GNU,Clang,AppleClang")
set(CLANG_LIKE "Clang,AppleClang")
+set(CMAKE_THREAD_PREFER_PTHREAD ON)
+find_package(Threads REQUIRED)
+
add_library(${ASTC_TARGET}-static
STATIC
astcenc_averages_and_directions.cpp
@@ -99,9 +102,6 @@ macro(astcenc_set_properties NAME)
target_compile_options(${NAME}
PRIVATE
- # Use pthreads on Linux/macOS
- $<$<PLATFORM_ID:Linux,Darwin>:-pthread>
-
# MSVC compiler defines
$<$<CXX_COMPILER_ID:MSVC>:/EHsc>
$<$<CXX_COMPILER_ID:MSVC>:/fp:strict>
@@ -133,10 +133,10 @@ macro(astcenc_set_properties NAME)
$<$<CXX_COMPILER_ID:Clang>:-Wdocumentation>)
- target_link_options(${NAME}
+ target_link_libraries(${NAME}
PRIVATE
# Use pthreads on Linux/macOS
- $<$<PLATFORM_ID:Linux,Darwin>:-pthread>)
+ Threads::Threads)
if(${ASAN})
target_compile_options(${NAME}
|