summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDan Albert <danalbert@google.com>2015-01-16 00:52:11 +0000
committerDan Albert <danalbert@google.com>2015-01-16 00:52:11 +0000
commit0b4f9d2b88eb6fa97a2560958941d4d270b5c0f3 (patch)
treeb495120752d9a088e1259b3694f7f20ceb10ca7b /CMakeLists.txt
parentf79ad2e945d36380b301850f86d6318d5f8469f0 (diff)
[libc++abi] Add support for cross compiling.
Reviewers: EricWF, jroelofs Reviewed By: jroelofs Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6991 git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@226235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt7
1 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e1563aa..4dc160a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -111,6 +111,8 @@ 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)
+set(LIBCXXABI_GCC_TOOLCHAIN "" CACHE STRING "GCC toolchain for cross compiling.")
+set(LIBCXXABI_SYSROOT "" CACHE STRING "Sysroot for cross compiling.")
# 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
@@ -245,6 +247,11 @@ if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
+list(APPEND LIBCXXABI_COMPILE_FLAGS "-target ${LIBCXXABI_TARGET_TRIPLE}")
+append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_GCC_TOOLCHAIN
+ "-gcc-toolchain ${LIBCXXABI_GCC_TOOLCHAIN}")
+append_if(LIBCXXABI_COMPILE_FLAGS LIBCXXABI_SYSROOT
+ "--sysroot ${LIBCXXABI_SYSROOT}")
string(REPLACE ";" " " LIBCXXABI_CXX_FLAGS "${LIBCXXABI_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCXXABI_CXX_FLAGS}")