[lldb] add check for libcxx runtime

Authored by rmaz on Feb 22 2021, 5:53 PM.


[lldb] add check for libcxx runtime

When enabling LLDB tests with LLVM_ENABLE_RUNTIMES=libcxx CMake will
fail with:

LLDB test suite requires libc++, but it is currently disabled.

The issue is that the targets in LLVM_ENABLE_RUNTIMES are configured
after the targets in LLVM_ENABLE_PROJECTS, so at this point the check
for the cxx target will fail. CMake will add a dependency for a target
that does not exist yet however, so by first checking for libcxx in
LLVM_ENABLE_RUNTIMES we ensure that the cxx target will be present at
build time.

Tested with:

% cmake -G Ninja \
    -C ~/local/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake \
    -DLIBCXX_INCLUDE_TESTS=NO ~/local/llvm-project/llvm
% ninja check-lldb

Reviewed By: smeenai, JDevlieghere

Differential Revision: https://reviews.llvm.org/D97227