[PATCH] D58598: [CMake] Support alternative C++ ABI library

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 24 16:51:10 PST 2019


phosek created this revision.
phosek added reviewers: smeenai, beanz.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

Do not assume that every platform has libsupc++.


Repository:
  rT test-suite

https://reviews.llvm.org/D58598

Files:
  CMakeLists.txt
  MultiSource/Applications/obsequi/CMakeLists.txt


Index: MultiSource/Applications/obsequi/CMakeLists.txt
===================================================================
--- MultiSource/Applications/obsequi/CMakeLists.txt
+++ MultiSource/Applications/obsequi/CMakeLists.txt
@@ -6,7 +6,7 @@
   list(APPEND CPPFLAGS -DHASHCODEBITS=23)
 endif()
 if(NOT "${ARCH}" STREQUAL "PowerPC")
-  list(APPEND LDFLAGS -lsupc++)
+  list(APPEND LDFLAGS -l${TEST_SUITE_CXX_ABI_LIBNAME})
 endif()
 set(RUN_OPTIONS < input)
 llvm_multisource(Obsequi)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -155,6 +155,21 @@
 set(CMAKE_EXE_LINKER_FLAGS
     "${CMAKE_EXE_LINKER_FLAGS} ${TEST_SUITE_EXTRA_EXE_LINKER_FLAGS}")
 
+# This is either directly the C++ ABI library or the full C++ library
+# which pulls in the ABI transitively.
+set(TEST_SUITE_CXX_ABI "default" CACHE STRING "Specify C++ ABI library to use.")
+set(CXXABIS none default libstdc++ libsupc++ libc++ libc++abi)
+set_property(CACHE TEST_SUITE_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
+if (TEST_SUITE_CXX_ABI STREQUAL "default")
+  if (APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD|Fuchsia")
+    set(TEST_SUITE_CXX_ABI_LIBNAME "c++")
+  else()
+    set(TEST_SUITE_CXX_ABI_LIBNAME "stdc++")
+  endif()
+else()
+  STRING(REGEX REPLACE "^lib" "" TEST_SUITE_CXX_ABI_LIBNAME ${TEST_SUITE_CXX_ABI})
+endif()
+
 include(TestSuite)
 include(SingleMultiSource)
 find_package(TCL)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58598.188096.patch
Type: text/x-patch
Size: 1445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190225/37fcf27a/attachment.bin>


More information about the llvm-commits mailing list