summaryrefslogtreecommitdiff
path: root/sci-libs/symengine/files/symengine-0.9.0-pthread-cmake.patch
blob: 0fa049dbf21899e6a313f28de05e1c0b8ed90add (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 6ad9620ffc578abdb920b84ea5e393c726389ac0 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 8 Jun 2022 06:02:25 +0100
Subject: [PATCH] cmake: fix pthread detection

The homebrew FindPTHREAD.cmake module was hardcoding the path to libpthread
in the installed CMake config file which broke consumers when upgrading from
< glibc-2.34 (e.g. glibc-2.33 -> glibc-2.34).

CMake provides FindThreads which does the job fine for us. Tested with both
glibc-2.33 (with a previously bad generated file, and then fixed) and glibc-2.35.

This should be fine on musl and friends too. This brings symengine in line
with most CMake packages.

Bug: https://bugs.gentoo.org/849803
Fixes: https://github.com/symengine/symengine/issues/1910
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -335,11 +335,10 @@ if (WITH_PIRANHA)
 endif()
 
 if (WITH_PTHREAD)
-    find_package(PTHREAD REQUIRED)
-    include_directories(SYSTEM ${PTHREAD_INCLUDE_DIRS})
-    set(LIBS ${LIBS} ${PTHREAD_TARGETS})
+    find_package(Threads)
+    set(THREADS_PREFER_PTHREAD_FLAG ON)
+    set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
     set(HAVE_SYMENGINE_PTHREAD yes)
-    set(PKGS ${PKGS} "PTHREAD")
 endif()
 
 if (WITH_MPFR)
@@ -761,10 +760,6 @@ if (WITH_BOOST)
 endif()
 
 message("WITH_PTHREAD: ${WITH_PTHREAD}")
-if (WITH_PTHREAD)
-    message("PTHREAD_INCLUDE_DIRS: ${PTHREAD_INCLUDE_DIRS}")
-    message("PTHREAD_LIBRARIES: ${PTHREAD_LIBRARIES}")
-endif()
 
 message("WITH_MPC: ${WITH_MPC}")
 if (WITH_MPC)
--- a/cmake/FindPTHREAD.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
-include(LibFindMacros)
-
-libfind_include(pthread.h pthread)
-libfind_library(pthread pthread)
-
-set(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY})
-set(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR})
-set(PTHREAD_TARGETS pthread)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(PTHREAD DEFAULT_MSG PTHREAD_LIBRARIES
-    PTHREAD_INCLUDE_DIRS)
-
-mark_as_advanced(PTHREAD_INCLUDE_DIR PTHEARD_LIBRARY)