From 87c87f4c3064ffb6aac01b2eff9189544a87b70b Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Fri, 10 Feb 2017 01:59:20 +0000 Subject: [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`. llvm-svn: 294690 --- llvm/lib/Fuzzer/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Fuzzer') diff --git a/llvm/lib/Fuzzer/CMakeLists.txt b/llvm/lib/Fuzzer/CMakeLists.txt index 5ba126e69cc..f490b3681b9 100644 --- a/llvm/lib/Fuzzer/CMakeLists.txt +++ b/llvm/lib/Fuzzer/CMakeLists.txt @@ -34,12 +34,12 @@ if( LLVM_USE_SANITIZE_COVERAGE ) add_library(LLVMFuzzerNoMain STATIC $ ) - target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB}) + target_link_libraries(LLVMFuzzerNoMain ${LLVM_PTHREAD_LIB}) add_library(LLVMFuzzer STATIC FuzzerMain.cpp $ ) - target_link_libraries(LLVMFuzzer ${PTHREAD_LIB}) + target_link_libraries(LLVMFuzzer ${LLVM_PTHREAD_LIB}) if( LLVM_INCLUDE_TESTS ) add_subdirectory(test) -- cgit v1.2.3