Currently the clang/unittests/Basic/CMakeLists.txt links LLVMTestingSupport in an incorrect way that would cause ninja check-clang failing with a linking error when the LLVM_LINK_LLVM_DYLIB variable is set to ON:
$ cmake ../llvm -DLLVM_ENABLE_PROJECTS="clang" \
-DLLVM_TARGETS_TO_BUILD="X86" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_ENABLE_ASSERTIONS=ON \ -DLLVM_LINK_LLVM_DYLIB=ON \ -G Ninja
$ ninja check-clang
...
/usr/bin/ld: tools/clang/unittests/Basic/CMakeFiles/BasicTests.dir/FileManagerTest.cpp.o: in function `(anonymous namespace)::FileManagerTest_getBypassFile_Test::TestBody()':
FileManagerTest.cpp:(.text._ZN12_GLOBAL__N_134FileManagerTest_getBypassFile_Test8TestBodyEv+0x3a3): undefined reference to `llvm::detail::TakeError(llvm::Error)'
This patch changes the linking method of LLVMTestingSupport from clang_target_link_libraries to target_link_libraries just like other tests have done.