[libcxxabi] Refactor building and testing libc++abi without threads
Summary:
This patch adds CMake support for building and testing libc++abi without threads.
1. Add `LIBCXXABI_ENABLE_THREADS` option to CMake.
2. Propagate `LIBCXXABI_ENABLE_THREADS` to lit via lit.site.cfg.in
3. Configure tests for `LIBCXXABI_ENABLE_THREADS=OFF
Currently the test suite does not work when libc++abi is built without threads because that information does not propagate to the test suite.
Reviewers: danalbert, mclow.lists, jroelofs
Reviewed By: jroelofs
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D6393
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@222702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1e472bf..c326265 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -106,6 +106,7 @@
option(LIBCXXABI_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXXABI_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXXABI_USE_LLVM_UNWINDER "Build and use the LLVM unwinder." OFF)
+option(LIBCXXABI_ENABLE_THREADS "Build with threads enabled" ON)
# Default to building a shared library so that the default options still test
# the libc++abi that is being built. There are two problems with testing a
@@ -226,6 +227,10 @@
list(APPEND LIBCXXABI_COMPILE_FLAGS -D_LIBCPP_BUILD_STATIC)
endif()
+if (NOT LIBCXXABI_ENABLE_THREADS)
+ add_definitions(-DLIBCXXABI_HAS_NO_THREADS=1)
+endif()
+
# This is the _ONLY_ place where add_definitions is called.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)