diff --git a/lldb/test/CMakeLists.txt b/lldb/test/CMakeLists.txt --- a/lldb/test/CMakeLists.txt +++ b/lldb/test/CMakeLists.txt @@ -139,6 +139,9 @@ ) endif() +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.") + # Add dependencies if we test with the in-tree clang. # This works with standalone builds as they import the clang target. if(TARGET clang) @@ -169,9 +172,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,