[libcxxabi] Teach CMake better ways to find the libc++ source directory (and misc cleanup).
Summary:
The main section of this patch teaches CMake a new option `LIBCXXABI_LIBCXX_PATH` that specifies the path to the libcxx source root. This information is passed to lit so that it can better find libc++'s python module. `LIBCXXABI_LIBCXX_PATH` is also used to help find the libc++ headers.
The rest of this patch is misc cleanup, mostly to make pep8 and pylint happy.
I've also copied libc++'s .gitignore into libc++abi.
Reviewers: jroelofs, danalbert
Reviewed By: danalbert
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D7130
git-svn-id: https://llvm.org/svn/llvm-project/libcxxabi/trunk@226855 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6be1e15..8402480 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,6 +97,7 @@
set(LIBCXXABI_BUILT_STANDALONE 1)
else()
+ set(LLVM_MAIN_SRC_DIR "${CMAKE_SOURCE_DIR}" CACHE PATH "Path to LLVM source tree")
set(LLVM_LIT "${CMAKE_SOURCE_DIR}/utils/lit/lit.py")
set(LIBCXXABI_LIBDIR_SUFFIX ${LLVM_LIBDIR_SUFFIX})
endif()
@@ -126,14 +127,32 @@
LIBCXXABI_LIBCXX_INCLUDES
vector
PATHS ${LIBCXXABI_LIBCXX_INCLUDES}
+ ${LIBCXXABI_LIBCXX_PATH}/include
${CMAKE_BINARY_DIR}/${LIBCXXABI_LIBCXX_INCLUDES}
${LLVM_MAIN_SRC_DIR}/projects/libcxx/include
${LLVM_INCLUDE_DIR}/c++/v1
)
-set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE STRING
+set(LIBCXXABI_LIBCXX_INCLUDES "${LIBCXXABI_LIBCXX_INCLUDES}" CACHE PATH
"Specify path to libc++ includes." FORCE)
+find_path(
+ LIBCXXABI_LIBCXX_PATH
+ test/libcxx/__init__.py
+ PATHS ${LIBCXXABI_LIBCXX_PATH}
+ ${LIBCXXABI_LIBCXX_INCLUDES}/../
+ ${LLVM_MAIN_SRC_DIR}/projects/libcxx/
+ NO_DEFAULT_PATH
+ )
+
+if (LIBCXXABI_LIBCXX_PATH STREQUAL "LIBCXXABI_LIBCXX_PATH-NOTFOUND")
+ message(WARNING "LIBCXXABI_LIBCXX_PATH was not specified and couldn't be infered.")
+ set(LIBCXXABI_LIBCXX_PATH "")
+endif()
+
+set(LIBCXXABI_LIBCXX_PATH "${LIBCXXABI_LIBCXX_PATH}" CACHE PATH
+ "Specify path to libc++ source." FORCE)
+
#===============================================================================
# Configure System
#===============================================================================