[lldb] add check for libcxx runtime
authorRichard Howell <rhow@fb.com>
Tue, 23 Feb 2021 01:53:18 +0000 (17:53 -0800)
committerShoaib Meenai <smeenai@fb.com>
Tue, 23 Feb 2021 01:53:54 +0000 (17:53 -0800)
commit389955c69a3b9f418e3f39694c94b4519322dd42
tree98505d3e9d3223e7c257d15acf645ffcee3862d5
parent06e25d56451977ef5b7052282faacfe3d42acb65
[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 \
    -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_RUNTIMES="libcxx" \
    -DLIBCXX_INCLUDE_TESTS=NO ~/local/llvm-project/llvm
% ninja check-lldb
```

Reviewed By: smeenai, JDevlieghere

Differential Revision: https://reviews.llvm.org/D97227
lldb/test/CMakeLists.txt