diff options
author | Chris Bieneman <chris.bieneman@me.com> | 2019-05-17 04:20:01 +0000 |
---|---|---|
committer | Chris Bieneman <chris.bieneman@me.com> | 2019-05-17 04:20:01 +0000 |
commit | 5766e93db0eba14a9a11974bbc6864dd02ebaabc (patch) | |
tree | 90a6b374f7b1668267edce97e2b3b1075d3252a3 /cmake | |
parent | 84c99291713b3297f16404846d904bd6cf2ad3cd (diff) | |
download | clang-5766e93db0eba14a9a11974bbc6864dd02ebaabc.tar.gz |
Re-land: 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/AddClang.cmake | 7 |
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}) |