Support standalone build of clang-tidy unittest

Apply the same pattern as the one used in clangd/unittests/CMakeLists.txt

Differential Revision: https://reviews.llvm.org/D96788
This commit is contained in:
serge-sans-paille 2021-02-16 15:47:18 +01:00
parent 2d6b767c1d
commit f0e4610572
1 changed files with 9 additions and 0 deletions

View File

@ -3,6 +3,15 @@ set(LLVM_LINK_COMPONENTS
Support
)
if(CLANG_BUILT_STANDALONE)
# LLVMTestingSupport library is needed for clang-tidy tests.
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
AND NOT TARGET LLVMTestingSupport)
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Testing/Support
lib/Testing/Support)
endif()
endif()
get_filename_component(CLANG_LINT_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/../../clang-tidy REALPATH)
include_directories(${CLANG_LINT_SOURCE_DIR})