summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-03-01 15:54:40 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-03-01 15:54:40 +0000
commit5cd721ae120eec72b795105830c76a087cd32dca (patch)
treeea98b272b3df007789383f99f7ca62eebdbb3329
parenta029b79e1a71b46b3e8d0ace236a2d935643cf7b (diff)
downloadbcm5719-llvm-5cd721ae120eec72b795105830c76a087cd32dca.tar.gz
bcm5719-llvm-5cd721ae120eec72b795105830c76a087cd32dca.zip
Refactor duplicated code for linking with pthread.
llvm-svn: 262344
-rwxr-xr-xllvm/cmake/config-ix.cmake4
-rw-r--r--llvm/examples/ParallelJIT/CMakeLists.txt4
-rw-r--r--llvm/lib/CodeGen/CMakeLists.txt7
-rw-r--r--llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt6
-rw-r--r--llvm/lib/Fuzzer/CMakeLists.txt8
-rw-r--r--llvm/lib/Support/CMakeLists.txt4
-rw-r--r--llvm/unittests/Support/CMakeLists.txt4
7 files changed, 13 insertions, 24 deletions
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index c5be442a2c5..86a106d26cf 100755
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -107,6 +107,10 @@ if( NOT PURE_WINDOWS )
check_library_exists(rt clock_gettime "" HAVE_LIBRT)
endif()
+if(HAVE_LIBPTHREAD)
+ set(PTHREAD_LIB pthread)
+endif()
+
# Don't look for these libraries on Windows. Also don't look for them if we're
# using MSan, since uninstrmented third party code may call MSan interceptors
# like strlen, leading to false positives.
diff --git a/llvm/examples/ParallelJIT/CMakeLists.txt b/llvm/examples/ParallelJIT/CMakeLists.txt
index 07c0a085b91..e85b470f503 100644
--- a/llvm/examples/ParallelJIT/CMakeLists.txt
+++ b/llvm/examples/ParallelJIT/CMakeLists.txt
@@ -11,6 +11,4 @@ add_llvm_example(ParallelJIT
ParallelJIT.cpp
)
-if(HAVE_LIBPTHREAD)
- target_link_libraries(ParallelJIT pthread)
-endif(HAVE_LIBPTHREAD)
+target_link_libraries(ParallelJIT ${PTHREAD_LIB})
diff --git a/llvm/lib/CodeGen/CMakeLists.txt b/llvm/lib/CodeGen/CMakeLists.txt
index de6d21dde5e..6ebde1aed53 100644
--- a/llvm/lib/CodeGen/CMakeLists.txt
+++ b/llvm/lib/CodeGen/CMakeLists.txt
@@ -1,8 +1,3 @@
-set(system_libs)
-if(CMAKE_HOST_UNIX AND LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD)
- set(system_libs ${system_libs} pthread)
-endif()
-
add_llvm_library(LLVMCodeGen
AggressiveAntiDepBreaker.cpp
AllocationOrder.cpp
@@ -135,7 +130,7 @@ add_llvm_library(LLVMCodeGen
${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen
${LLVM_MAIN_INCLUDE_DIR}/llvm/CodeGen/PBQP
- LINK_LIBS ${system_libs}
+ LINK_LIBS ${PTHREAD_LIB}
)
add_dependencies(LLVMCodeGen intrinsics_gen)
diff --git a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
index 65f2a2f51f9..3b8c4b973e6 100644
--- a/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/IntelJITEvents/CMakeLists.txt
@@ -3,9 +3,9 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. )
if( HAVE_LIBDL )
set(LLVM_INTEL_JIT_LIBS ${CMAKE_DL_LIBS})
endif()
-if( HAVE_LIBPTHREAD )
- set(LLVM_INTEL_JIT_LIBS pthread ${LLVM_INTEL_JIT_LIBS})
-endif()
+
+set(LLVM_INTEL_JIT_LIBS ${PTHREAD_LIB} ${LLVM_INTEL_JIT_LIBS})
+
add_llvm_library(LLVMIntelJITEvents
IntelJITEventListener.cpp
diff --git a/llvm/lib/Fuzzer/CMakeLists.txt b/llvm/lib/Fuzzer/CMakeLists.txt
index eeae5112ca5..3fae903c44c 100644
--- a/llvm/lib/Fuzzer/CMakeLists.txt
+++ b/llvm/lib/Fuzzer/CMakeLists.txt
@@ -18,16 +18,12 @@ if( LLVM_USE_SANITIZE_COVERAGE )
add_library(LLVMFuzzerNoMain STATIC
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
)
- if( HAVE_LIBPTHREAD )
- target_link_libraries(LLVMFuzzerNoMain pthread)
- endif()
+ target_link_libraries(LLVMFuzzerNoMain ${PTHREAD_LIB})
add_library(LLVMFuzzer STATIC
FuzzerMain.cpp
$<TARGET_OBJECTS:LLVMFuzzerNoMainObjects>
)
- if( HAVE_LIBPTHREAD )
- target_link_libraries(LLVMFuzzer pthread)
- endif()
+ target_link_libraries(LLVMFuzzer ${PTHREAD_LIB})
if( LLVM_INCLUDE_TESTS )
add_subdirectory(test)
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index bccbdfca4c4..d14d7d305fd 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -17,9 +17,7 @@ elseif( CMAKE_HOST_UNIX )
if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
set(system_libs ${system_libs} atomic)
endif()
- if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
- set(system_libs ${system_libs} pthread)
- endif()
+ set(system_libs ${system_libs} ${PTHREAD_LIB})
if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
set(system_libs ${system_libs} z)
endif()
diff --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt
index 607b92e547a..690a2e376a3 100644
--- a/llvm/unittests/Support/CMakeLists.txt
+++ b/llvm/unittests/Support/CMakeLists.txt
@@ -53,6 +53,4 @@ add_llvm_unittest(SupportTests
)
# ManagedStatic.cpp uses <pthread>.
-if(LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD)
- target_link_libraries(SupportTests pthread)
-endif()
+target_link_libraries(SupportTests ${PTHREAD_LIB})
OpenPOWER on IntegriCloud