[CMake] Apply r279151 cleanup to libc++abi.

This patch applies changes similar to those in r279515 to libc++abi.

Summary of changes in this patch:

* Renamed variable LLVM_CONFIG -> LLVM_CONFIG_PATH
* Renamed variable LIBCXXABI_BUILT_STANDALONE -> LIBCXXABI_STANDALONE_BUILD
* Add an include of AddLLVM in the tests subdirectory for add_lit_testsuite.

llvm-svn: 279936
This commit is contained in:
Eric Fiselier 2016-08-28 18:16:18 +00:00
parent 0b7b36a9dd
commit 4b3308c27f
4 changed files with 13 additions and 10 deletions

View File

@ -13,15 +13,17 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
# Rely on llvm-config.
set(CONFIG_OUTPUT)
find_program(LLVM_CONFIG "llvm-config")
if (NOT LLVM_CONFIG_PATH)
find_program(LLVM_CONFIG_PATH "llvm-config")
endif()
if(DEFINED LLVM_PATH)
set(LLVM_INCLUDE_DIR ${LLVM_INCLUDE_DIR} CACHE PATH "Path to llvm/include")
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
elseif(LLVM_CONFIG)
message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}")
set(CONFIG_COMMAND ${LLVM_CONFIG}
elseif(LLVM_CONFIG_PATH)
message(STATUS "Found LLVM_CONFIG_PATH as ${LLVM_CONFIG_PATH}")
set(CONFIG_COMMAND ${LLVM_CONFIG_PATH}
"--includedir"
"--prefix"
"--src-root")
@ -51,7 +53,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LLVM_LIT_PATH "${LLVM_PATH}/utils/lit/lit.py")
else()
message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
"Reconfigure with -DLLVM_CONFIG_PATH=path/to/llvm-config "
"or -DLLVM_PATH=path/to/llvm-source-root.")
endif()
@ -96,7 +98,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXXABI_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING
"Define suffix of library directory name (32/64)")
set(LIBCXXABI_BUILT_STANDALONE 1)
set(LIBCXXABI_STANDALONE_BUILD 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")
@ -388,7 +390,7 @@ endif()
# soname, etc...
add_subdirectory(src)
if (LIBCXXABI_BUILT_STANDALONE AND NOT LIBCXXABI_ENABLE_SHARED)
if (LIBCXXABI_STANDALONE_BUILD AND NOT LIBCXXABI_ENABLE_SHARED)
# We can't reasonably test the system C++ library with a static libc++abi.
# We either need to be able to replace libc++abi at run time (with a shared
# libc++abi), or we need to be able to replace the C++ runtime (with a non-

View File

@ -55,7 +55,7 @@ endif()
append_if(libraries LIBCXXABI_HAS_C_LIB c)
if (LIBCXXABI_USE_LLVM_UNWINDER)
if (NOT LIBCXXABI_BUILT_STANDALONE)
if (NOT LIBCXXABI_STANDALONE_BUILD)
if (LIBUNWIND_ENABLE_SHARED)
list(APPEND libraries unwind_shared)
else()

View File

@ -1,3 +1,4 @@
include(AddLLVM) # for add_lit_testsuite
macro(pythonize_bool var)
if (${var})
set(${var} True)
@ -34,7 +35,7 @@ else()
set(LIBCXXABI_TEST_DEPS cxxabi_static)
endif()
if (NOT LIBCXXABI_BUILT_STANDALONE)
if (NOT LIBCXXABI_STANDALONE_BUILD)
list(APPEND LIBCXXABI_TEST_DEPS cxx)
if (LIBCXXABI_USE_LLVM_UNWINDER)
list(APPEND LIBCXXABI_TEST_DEPS unwind)

View File

@ -104,7 +104,7 @@
configure CMake using either of the following options.
</p>
<ul>
<li><code>-DLLVM_CONFIG=path/to/llvm-config</code></li>
<li><code>-DLLVM_CONFIG_PATH=path/to/llvm-config</code></li>
<li><code>-DLLVM_PATH=path/to/llvm-source-root</code></li>
</ul>