diff options
author | Petr Hosek <phosek@chromium.org> | 2017-02-16 05:18:08 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2017-02-16 05:18:08 +0000 |
commit | c73a6f2e77ef8e010f813219dc909c6ccda5a6ff (patch) | |
tree | 2e5a26d5a5896f02fcb9bc42a300e6921752235a /libunwind/CMakeLists.txt | |
parent | 5907b3eeab8d02f28255ada152d6a0a169cd91c6 (diff) |
[libunwind][CMake] Use libc++ headers when available
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
Diffstat (limited to 'libunwind/CMakeLists.txt')
-rw-r--r-- | libunwind/CMakeLists.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt index 3ba4b65d175..32c215c6580 100644 --- a/libunwind/CMakeLists.txt +++ b/libunwind/CMakeLists.txt @@ -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) |