Skip to content

Commit

Permalink
[libunwind][CMake] Use libc++ headers when available
Browse files Browse the repository at this point in the history
libunwind depends on C++ library headers. When building libunwind
as part of LLVM and libc++ is available, use its headers.

Differential Revision: https://reviews.llvm.org/D29997

llvm-svn: 295285
  • Loading branch information
petrhosek committed Feb 16, 2017
1 parent f351ac8 commit 63524f5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions libunwind/CMakeLists.txt
Expand Up @@ -282,4 +282,24 @@ endif()

include_directories(include)

find_path(
LIBUNWIND_LIBCXX_INCLUDES_INTERNAL
__libcpp_version
PATHS ${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
${LLVM_MAIN_SRC_DIR}/runtimes/libcxx/include
NO_DEFAULT_PATH
)
if ((NOT LIBUNWIND_STANDALONE_BUILD OR HAVE_LIBCXX) AND
IS_DIRECTORY "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
set(LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT "${LIBUNWIND_LIBCXX_INCLUDES_INTERNAL}")
endif()

set(LIBUNWIND_CXX_INCLUDE_PATHS "${LIBUNWIND_CXX_INCLUDE_PATHS_DEFAULT}" CACHE PATH
"Paths to C++ header directories separated by ';'.")

if (NOT LIBUNWIND_CXX_INCLUDE_PATHS STREQUAL "")
list(APPEND LIBUNWIND_CXX_FLAGS -nostdinc++)
include_directories("${LIBUNWIND_CXX_INCLUDE_PATHS}")
endif()

add_subdirectory(src)

0 comments on commit 63524f5

Please sign in to comment.