[cmake] Fix standalone+LLVM_LINK_LLVM_DYLIB builds (pr36687)

Summary:
To make this build work, I needed to add detection code for the pthread
library. This is necessary, because we have direct calls to these
libraries (instead of going through llvm) and in the standalone build we
cannot rely on llvm to detect these for us. In a standalone non-dylib
build this was accidentaly working because these libraries were pulled
in as an interface dependency of the .a files, but in a dylib build
these are no longer part of the link interface, and so we need to add
them explicitly.

Reviewers: krytarowski, zturner

Subscribers: lldb-commits, mgorny

Differential Revision: https://reviews.llvm.org/D44379

llvm-svn: 327490
This commit is contained in:
Pavel Labath 2018-03-14 10:08:21 +00:00
parent fe9922f8af
commit 10ef313678

View File

@ -346,14 +346,18 @@ else()
endif()
if (HAVE_LIBPTHREAD)
list(APPEND system_libs pthread)
endif(HAVE_LIBPTHREAD)
if (HAVE_LIBDL)
list(APPEND system_libs ${CMAKE_DL_LIBS})
if( WIN32 AND NOT CYGWIN )
set(PURE_WINDOWS 1)
endif()
if(NOT PURE_WINDOWS)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads REQUIRED)
list(APPEND system_libs ${CMAKE_THREAD_LIBS_INIT})
endif()
list(APPEND system_libs ${CMAKE_DL_LIBS})
# Figure out if lldb could use lldb-server. If so, then we'll
# ensure we build lldb-server when an lldb target is being built.
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")