[lldb] Correctly add runtime test dependencies

When a runtime is enabled through LLVM_ENABLE_RUNTIMES, it is loaded
after other projects (i.e. after LLDB). This means that the
corresponding targets don't exist when LLDB is configured. To support
runtimes being enable this way, we need to check if they're listed in
LLVM_ENABLE_RUNTIMES. For runtimes being enabled as projects (i.e.
through LLVM_ENABLE_RUNTIMES) we need to check for the target.

This patch unifies things and correctly adds compiler-rt and libcxx as
test dependencies in both scenarios.
This commit is contained in:
Jonas Devlieghere 2022-08-31 16:33:54 -07:00
parent 5b0863f3ef
commit c7511b4ecf
No known key found for this signature in database
GPG Key ID: 49CC0BD90FDEED4D
1 changed files with 6 additions and 21 deletions

View File

@ -95,22 +95,16 @@ endif()
if(TARGET clang)
add_lldb_test_dependency(clang)
if(TARGET asan)
add_lldb_test_dependency(asan)
if (TARGET libcxx OR ("libcxx" IN_LIST LLVM_ENABLE_RUNTIMES))
set(LLDB_HAS_LIBCXX ON)
add_lldb_test_dependency(cxx)
endif()
if(TARGET tsan)
add_lldb_test_dependency(tsan)
endif()
if (TARGET compiler-rt)
if (TARGET compiler-rt OR "compiler-rt" IN_LIST LLVM_ENABLE_RUNTIMES)
set(LLDB_HAS_COMPILER_RT ON)
add_lldb_test_dependency(compiler-rt)
endif()
if (TARGET runtimes)
add_lldb_test_dependency(runtimes)
endif()
if(APPLE AND NOT LLVM_TARGET_IS_CROSSCOMPILE_HOST)
# FIXME: Standalone builds should import the cxx target as well.
if(LLDB_BUILT_STANDALONE)
@ -122,7 +116,7 @@ if(TARGET clang)
else()
# We require libcxx for the test suite, so if we aren't building it,
# provide a helpful error about how to resolve the situation.
if(NOT TARGET cxx AND NOT libcxx IN_LIST LLVM_ENABLE_RUNTIMES)
if(NOT LLDB_HAS_LIBCXX)
message(FATAL_ERROR
"LLDB test suite requires libc++, but it is currently disabled. "
"Please add `libcxx` to `LLVM_ENABLE_RUNTIMES` or disable tests via "
@ -130,15 +124,6 @@ if(TARGET clang)
endif()
endif()
endif()
# Add libc++ dependency for libc++-specific tests. This is an optional
# dependency as it's also possible to run the libc++ tests against the libc++
# installed on the system.
if (TARGET cxx)
set(LLDB_HAS_LIBCXX ON)
add_lldb_test_dependency(cxx)
endif()
endif()
if (LLDB_BUILT_STANDALONE)