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.
ParallelJIT.cpp
)
-if(HAVE_LIBPTHREAD)
- target_link_libraries(ParallelJIT pthread)
-endif(HAVE_LIBPTHREAD)
+target_link_libraries(ParallelJIT ${PTHREAD_LIB})
-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
${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)
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
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)
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()
)
# ManagedStatic.cpp uses <pthread>.
-if(LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD)
- target_link_libraries(SupportTests pthread)
-endif()
+target_link_libraries(SupportTests ${PTHREAD_LIB})