summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChris Bieneman <chris.bieneman@me.com>2019-05-16 22:06:07 +0000
committerChris Bieneman <chris.bieneman@me.com>2019-05-16 22:06:07 +0000
commit5b9ebf3d7d072f39ed63007643c75fcc4ed5ffa7 (patch)
tree69fd049439814be0189165f66f213fab5ac323c7 /cmake
parent25284eec9e11c1808306e57a76d3e2eaa90fc5af (diff)
downloadclang-5b9ebf3d7d072f39ed63007643c75fcc4ed5ffa7.tar.gz
Add Clang shared library with C++ exports
Summary: This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two. This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries. Reviewers: tstellar, winksaville Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61909 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360946 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddClang.cmake7
1 files changed, 5 insertions, 2 deletions
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
index 18bac7172b..b598f13ff6 100644
--- a/cmake/modules/AddClang.cmake
+++ b/cmake/modules/AddClang.cmake
@@ -81,9 +81,12 @@ macro(add_clang_library name)
)
endif()
if(ARG_SHARED)
- set(ARG_ENABLE_SHARED SHARED)
+ set(LIBTYPE SHARED)
+ else()
+ set(LIBTYPE STATIC OBJECT)
+ set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
endif()
- llvm_add_library(${name} ${ARG_ENABLE_SHARED} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
+ llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
if(TARGET ${name})
target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})