summaryrefslogtreecommitdiff
path: root/libunwind/CMakeLists.txt
diff options
context:
space:
mode:
authorPetr Hosek <phosek@chromium.org>2017-02-09 02:20:25 +0000
committerPetr Hosek <phosek@chromium.org>2017-02-09 02:20:25 +0000
commit5ae8aa2e8707640b48629f1aa36197e5a6c22371 (patch)
tree56340994b8f161920a0cc36a5b21e50e6a7e1ce9 /libunwind/CMakeLists.txt
parent6412705d857635cbb21bcf463df70296fee59d8d (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/D29573
Diffstat (limited to 'libunwind/CMakeLists.txt')
-rw-r--r--libunwind/CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/libunwind/CMakeLists.txt b/libunwind/CMakeLists.txt
index 3ba4b65d175..7f1a118958b 100644
--- a/libunwind/CMakeLists.txt
+++ b/libunwind/CMakeLists.txt
@@ -282,4 +282,23 @@ 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 "")
+ include_directories("${LIBUNWIND_CXX_INCLUDE_PATHS}")
+endif()
+
add_subdirectory(src)