summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2019-02-15 18:25:26 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2019-02-15 18:25:26 +0000
commit2bc86f57b732cdec6b72879adb88faac88346a28 (patch)
treed69408e666d3017a4cb5a0520ceedbaaa8e8de3a /CMakeLists.txt
parent0166a9e5175baac4e0e5614952df1c945866710f (diff)
downloadcompiler-rt-2bc86f57b732cdec6b72879adb88faac88346a28.tar.gz
Revert "[compiler-rt] Cleanup usage of C++ ABI library"
This reverts r354132 because it breaks sanitizer-x86_64-linux: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/19915 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@354153 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt72
1 files changed, 25 insertions, 47 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a8face86..3b2b5145f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -197,38 +197,26 @@ if (cxxabi_supported AND SANITIZER_ALLOW_CXXABI)
endif()
pythonize_bool(SANITIZER_CAN_USE_CXXABI)
-macro(handle_default_cxx_lib var)
- if (${var} STREQUAL "default")
- if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
- set(${var}_LIBNAME "libc++")
- set(${var}_SYSTEM 1)
- elseif (FUCHSIA)
- set(${var}_LIBNAME "libc++")
- set(${var}_INTREE 1)
- else()
- set(${var}_LIBNAME "libstdc++")
- set(${var}_SYSTEM 1)
- endif()
- else()
- set(${var}_LIBNAME "${${var}}")
- set(${var}_SYSTEM 1)
- endif()
-endmacro()
-
-# This is either directly the C++ ABI library or the full C++ library
-# which pulls in the ABI transitively.
set(SANITIZER_CXX_ABI "default" CACHE STRING
"Specify C++ ABI library to use.")
-set(CXXABIS none default libstdc++ libc++ libcxxabi)
+set(CXXABIS none default libstdc++ libc++)
set_property(CACHE SANITIZER_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
-handle_default_cxx_lib(SANITIZER_CXX_ABI)
-# This needs to be a full C++ library for linking gtest and unit tests.
-set(SANITIZER_TEST_CXX "default" CACHE STRING
- "Specify C++ library to use for tests.")
-set(CXXLIBS none default libstdc++ libc++)
-set_property(CACHE SANITIZER_TEST_CXX PROPERTY STRINGS ;${CXXLIBS})
-handle_default_cxx_lib(SANITIZER_TEST_CXX)
+if (SANITIZER_CXX_ABI STREQUAL "default")
+ if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ set(SANITIZER_CXX_ABI_LIBNAME "libc++")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
+ elseif (FUCHSIA)
+ set(SANITIZER_CXX_ABI_LIBNAME "libc++")
+ set(SANITIZER_CXX_ABI_INTREE 1)
+ else()
+ set(SANITIZER_CXX_ABI_LIBNAME "libstdc++")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
+ endif()
+else()
+ set(SANITIZER_CXX_ABI_LIBNAME "${SANITIZER_CXX_ABI}")
+ set(SANITIZER_CXX_ABI_SYSTEM 1)
+endif()
set(DEFAULT_SANITIZER_USE_STATIC_LLVM_UNWINDER OFF)
if (FUCHSIA)
@@ -424,36 +412,26 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia")
list(APPEND SANITIZER_COMMON_LINK_LIBS zircon)
endif()
-macro(append_libcxx_libs var)
- if (${var}_INTREE)
+if (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++")
+ if (SANITIZER_CXX_ABI_INTREE)
if (SANITIZER_USE_STATIC_LLVM_UNWINDER AND (TARGET unwind_static OR HAVE_LIBUNWIND))
- list(APPEND ${var}_LIBRARIES unwind_static)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY unwind_static)
elseif (TARGET unwind_shared OR HAVE_LIBUNWIND)
- list(APPEND ${var}_LIBRARIES unwind_shared)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY unwind_shared)
endif()
if (SANITIZER_USE_STATIC_CXX_ABI AND (TARGET cxxabi_static OR HAVE_LIBCXXABI))
- list(APPEND ${var}_LIBRARIES cxxabi_static)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY cxxabi_static)
elseif (TARGET cxxabi_shared OR HAVE_LIBCXXABI)
- list(APPEND ${var}_LIBRARIES cxxabi_shared)
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY cxxabi_shared)
endif()
else()
- append_list_if(COMPILER_RT_HAS_LIBCXX c++ ${var}_LIBRARIES)
+ append_list_if(COMPILER_RT_HAS_LIBCXX c++ SANITIZER_CXX_ABI_LIBRARY)
endif()
-endmacro()
-
-if (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libc++")
- append_libcxx_libs(SANITIZER_CXX_ABI)
elseif (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libcxxabi")
- list(APPEND SANITIZER_CXX_ABI_LIBRARIES "c++abi")
+ list(APPEND SANITIZER_CXX_ABI_LIBRARY "c++abi")
elseif (SANITIZER_CXX_ABI_LIBNAME STREQUAL "libstdc++")
- append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_CXX_ABI_LIBRARIES)
-endif()
-
-if (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libc++")
- append_libcxx_libs(SANITIZER_TEST_CXX)
-elseif (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libstdc++")
- append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_TEST_CXX_LIBRARIES)
+ append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_CXX_ABI_LIBRARY)
endif()
# Warnings to turn off for all libraries, not just sanitizers.