Skip to content

Commit

Permalink
[libc++abi] Add support for cross compiling.
Browse files Browse the repository at this point in the history
Reviewers: EricWF, jroelofs

Reviewed By: jroelofs

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6991

llvm-svn: 226235
  • Loading branch information
DanAlbert committed Jan 16, 2015
1 parent 014bb7d commit 1fc2441
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libcxxabi/CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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}")

Expand Down

0 comments on commit 1fc2441

Please sign in to comment.