aboutsummaryrefslogtreecommitdiffstats
path: root/community/lld/cmake-fix-pthread-handling-for-out-of-tree-builds.patch
blob: b2a66f1a13148d0186d8a84e5021b6dbb903301f (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
From 548cd5eb4f45de4ec71b3421a98c9462aed75c91 Mon Sep 17 00:00:00 2001
From: Eric Fiselier <eric@efcs.ca>
Date: Fri, 10 Feb 2017 01:59:20 +0000
Subject: [PATCH] [CMake] Fix pthread handling for out-of-tree builds

LLVM defines `PTHREAD_LIB` which is used by AddLLVM.cmake and various projects
to correctly link the threading library when needed. Unfortunately
`PTHREAD_LIB` is defined by LLVM's `config-ix.cmake` file which isn't installed
and therefore can't be used when configuring out-of-tree builds. This causes
such builds to fail since `pthread` isn't being correctly linked.

This patch attempts to fix that problem by renaming and exporting
`LLVM_PTHREAD_LIB` as part of`LLVMConfig.cmake`. I renamed `PTHREAD_LIB`
because It seemed likely to cause collisions with downstream users of
`LLVMConfig.cmake`.


git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@294690 91177308-0d34-0410-b5e6-96231b3b80d8

Source: http://pkgs.fedoraproject.org/cgit/rpms/lld.git/tree/0001-CMake-Fix-pthread-handling-for-out-of-tree-builds.patch
---
 COFF/CMakeLists.txt                   | 2 +-
 ELF/CMakeLists.txt                    | 2 +-
 lib/ReaderWriter/MachO/CMakeLists.txt | 2 +-
 unittests/CoreTests/CMakeLists.txt    | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/COFF/CMakeLists.txt b/COFF/CMakeLists.txt
index 0eebe93..8f24e36 100644
--- a/COFF/CMakeLists.txt
+++ b/COFF/CMakeLists.txt
@@ -43,7 +43,7 @@ add_lld_library(lldCOFF
 
   LINK_LIBS
   lldCore
-  ${PTHREAD_LIB}
+  ${LLVM_PTHREAD_LIB}
 
   DEPENDS
   COFFOptionsTableGen
diff --git a/ELF/CMakeLists.txt b/ELF/CMakeLists.txt
index 5652b93..0d1e5b2 100644
--- a/ELF/CMakeLists.txt
+++ b/ELF/CMakeLists.txt
@@ -54,7 +54,7 @@ add_lld_library(lldELF
   LINK_LIBS
   lldConfig
   lldCore
-  ${PTHREAD_LIB}
+  ${LLVM_PTHREAD_LIB}
 
   DEPENDS
   ELFOptionsTableGen
diff --git a/lib/ReaderWriter/MachO/CMakeLists.txt b/lib/ReaderWriter/MachO/CMakeLists.txt
index 3b06985..5a96d87 100644
--- a/lib/ReaderWriter/MachO/CMakeLists.txt
+++ b/lib/ReaderWriter/MachO/CMakeLists.txt
@@ -28,7 +28,7 @@ add_lld_library(lldMachO
   LINK_LIBS
     lldCore
     lldYAML
-    ${PTHREAD_LIB}
+    ${LLVM_PTHREAD_LIB}
   )
 
 include_directories(.)
diff --git a/unittests/CoreTests/CMakeLists.txt b/unittests/CoreTests/CMakeLists.txt
index 98405d5..72e7c44 100644
--- a/unittests/CoreTests/CMakeLists.txt
+++ b/unittests/CoreTests/CMakeLists.txt
@@ -3,5 +3,5 @@ add_lld_unittest(CoreTests
   )
 
 target_link_libraries(CoreTests
-  ${PTHREAD_LIB}
+  ${LLVM_PTHREAD_LIB}
   )
-- 
1.8.3.1