diff options
author | Petr Hosek <phosek@chromium.org> | 2019-01-24 03:18:29 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-01-24 03:18:29 +0000 |
commit | 8807db320988f953b2d8d4859fe012955e63ba66 (patch) | |
tree | 45d6d46f9210cad5fbf5a843e7e1e5b07e2f1799 /libcxxabi/cmake | |
parent | 8c84e00c71f341d1e4bf0331f1a4b78879fe7f14 (diff) | |
download | llvm-8807db320988f953b2d8d4859fe012955e63ba66.tar.gz |
[libcxxabi] Support building hermetic static library
This is useful when the static libc++abi library is being linked into
shared libraries that may be used in with other shared libraries that
use different C++ library. We want to avoid avoid exporting libc++abi
or libc++ symbols in those cases. This achieved by a new CMake option
which can be enabled by libc++abi vendors as needed.
Differential Revision: https://reviews.llvm.org/D56026
llvm-svn: 352017
Diffstat (limited to 'libcxxabi/cmake')
-rw-r--r-- | libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake b/libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake index 3eddd7bdc628..19d6e93b20b0 100644 --- a/libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake +++ b/libcxxabi/cmake/Modules/HandleLibcxxabiFlags.cmake @@ -44,6 +44,29 @@ macro(check_flag_supported flag) check_cxx_compiler_flag("${flag}" "LIBCXXABI_SUPPORTS_${flagname}_FLAG") endmacro() +macro(append_flags DEST) + foreach(value ${ARGN}) + list(APPEND ${DEST} ${value}) + list(APPEND ${DEST} ${value}) + endforeach() +endmacro() + +# If the specified 'condition' is true then append the specified list of flags to DEST +macro(append_flags_if condition DEST) + if (${condition}) + list(APPEND ${DEST} ${ARGN}) + endif() +endmacro() + +# Add each flag in the list specified by DEST if that flag is supported by the current compiler. +macro(append_flags_if_supported DEST) + foreach(flag ${ARGN}) + mangle_name("${flag}" flagname) + check_cxx_compiler_flag("${flag}" "LIBCXXABI_SUPPORTS_${flagname}_FLAG") + append_flags_if(LIBCXXABI_SUPPORTS_${flagname}_FLAG ${DEST} ${flag}) + endforeach() +endmacro() + # Add a macro definition if condition is true. macro(define_if condition def) if (${condition}) |