Merging r294690:
------------------------------------------------------------------------
r294690 | ericwf | 2017-02-09 20:59:20 -0500 (Thu, 09 Feb 2017) | 13 lines
[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/branches/release_40@303400 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/COFF/CMakeLists.txt b/COFF/CMakeLists.txt
index 70a33b9..d51750f 100644
--- a/COFF/CMakeLists.txt
+++ b/COFF/CMakeLists.txt
@@ -40,7 +40,7 @@
LINK_LIBS
lldCore
- ${PTHREAD_LIB}
+ ${LLVM_PTHREAD_LIB}
DEPENDS
COFFOptionsTableGen
diff --git a/ELF/CMakeLists.txt b/ELF/CMakeLists.txt
index 2e9d2b9..6c67661 100644
--- a/ELF/CMakeLists.txt
+++ b/ELF/CMakeLists.txt
@@ -53,7 +53,7 @@
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 @@
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 @@
)
target_link_libraries(CoreTests
- ${PTHREAD_LIB}
+ ${LLVM_PTHREAD_LIB}
)