diff options
author | Louis Dionne <ldionne@apple.com> | 2019-10-02 20:07:01 +0000 |
---|---|---|
committer | Louis Dionne <ldionne@apple.com> | 2019-10-02 20:07:01 +0000 |
commit | 925d9d2e1443e49f2e4b7a4a674bb7bfe29609b0 (patch) | |
tree | 2ef00deaca532e1bdb194b7b11b49e120a62003c /libcxx/src | |
parent | 9ac0cda40a495d6fd78e03fe6432a680a3854c62 (diff) | |
download | bcm5719-llvm-925d9d2e1443e49f2e4b7a4a674bb7bfe29609b0.tar.gz bcm5719-llvm-925d9d2e1443e49f2e4b7a4a674bb7bfe29609b0.zip |
[libc++] Use functions instead of global variables to set libc++ build flags
This commit follows the trend of doing things per-target instead of
modifying the C++ flags globally. It does so for visibility-related
flags, other basic build flags and Windows-specific flags.
llvm-svn: 373517
Diffstat (limited to 'libcxx/src')
-rw-r--r-- | libcxx/src/CMakeLists.txt | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt index b85243fc751..c9c3f180870 100644 --- a/libcxx/src/CMakeLists.txt +++ b/libcxx/src/CMakeLists.txt @@ -204,35 +204,6 @@ function(cxx_set_common_defines name) if(LIBCXX_CXX_ABI_HEADER_TARGET) add_dependencies(${name} ${LIBCXX_CXX_ABI_HEADER_TARGET}) endif() - # Our visibility annotations are not quite right for non-Clang compilers, - # so we end up not exporting all the symbols we should. In the future, we - # can improve the situation by providing an explicit list of exported - # symbols on all compilers. - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - target_compile_options(${name} PRIVATE -fvisibility=hidden) - endif() - if(WIN32 AND NOT MINGW) - target_compile_definitions(${name} - PRIVATE - # Ignore the -MSC_VER mismatch, as we may build - # with a different compatibility version. - _ALLOW_MSC_VER_MISMATCH - # Don't check the msvcprt iterator debug levels - # as we will define the iterator types; libc++ - # uses a different macro to identify the debug - # level. - _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH - # We are building the c++ runtime, don't pull in - # msvcprt. - _CRTBLD - # Don't warn on the use of "deprecated" - # "insecure" functions which are standards - # specified. - _CRT_SECURE_NO_WARNINGS - # Use the ISO conforming behaviour for conversion - # in printf, scanf. - _CRT_STDIO_ISO_WIDE_SPECIFIERS) - endif() if (LIBCXX_ENABLE_PARALLEL_ALGORITHMS) target_link_libraries(${name} PUBLIC pstl::ParallelSTL) @@ -259,8 +230,10 @@ if (LIBCXX_ENABLE_SHARED) SOVERSION "${LIBCXX_ABI_VERSION}" DEFINE_SYMBOL "" ) + cxx_add_basic_build_flags(cxx_shared) cxx_set_common_defines(cxx_shared) cxx_add_warning_flags(cxx_shared) + cxx_add_windows_flags(cxx_shared) # Link against LLVM libunwind if (LIBCXXABI_USE_LLVM_UNWINDER) @@ -360,8 +333,10 @@ if (LIBCXX_ENABLE_STATIC) LINK_FLAGS "${LIBCXX_LINK_FLAGS}" OUTPUT_NAME "c++" ) + cxx_add_basic_build_flags(cxx_static) cxx_set_common_defines(cxx_static) cxx_add_warning_flags(cxx_static) + cxx_add_windows_flags(cxx_static) if (LIBCXX_HERMETIC_STATIC_LIBRARY) # If the hermetic library doesn't define the operator new/delete functions |