diff --git a/lldb/cmake/modules/LLDBStandalone.cmake b/lldb/cmake/modules/LLDBStandalone.cmake --- a/lldb/cmake/modules/LLDBStandalone.cmake +++ b/lldb/cmake/modules/LLDBStandalone.cmake @@ -16,6 +16,9 @@ set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_INCLUDE_DIR} CACHE PATH "Path to llvm/include") set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR} CACHE PATH "Path to LLVM build tree") +set(LLDB_TEST_LIBCXX_ROOT_DIR "${LLVM_BINARY_DIR}" CACHE PATH + "The build root for libcxx. Used in standalone builds to point the API tests to a custom build of libcxx.") + set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit") set(lit_file_name "llvm-lit") diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -169,9 +169,18 @@ # FIXME: Standalone builds should import the cxx target as well. if(LLDB_BUILT_STANDALONE) # For now check that the include directory exists. - set(cxx_dir "${LLVM_BINARY_DIR}/include/c++") - if(NOT EXISTS ${cxx_dir}) - message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}") + set(cxx_dir "${LLDB_TEST_LIBCXX_ROOT_DIR}/include/c++") + if(EXISTS ${cxx_dir}) + # These variables make sure the API tests can run against a custom + # build of libcxx even for standalone builds. + set(LLDB_HAS_LIBCXX ON) + set(LIBCXX_LIBRARY_DIR "${LLDB_TEST_LIBCXX_ROOT_DIR}/lib${LIBCXX_LIBDIR_SUFFIX}") + set(LIBCXX_GENERATED_INCLUDE_DIR "${LLDB_TEST_LIBCXX_ROOT_DIR}/include/c++/v1") + else() + message(FATAL_ERROR + "Couldn't find libcxx build in '${LLDB_TEST_LIBCXX_ROOT_DIR}'. To run the " + "test-suite for a standalone LLDB build please build libcxx and point " + "LLDB_TEST_LIBCXX_ROOT_DIR to it.") endif() else() # We require libcxx for the test suite, so if we aren't building it,