[clang-tools-extra] f0e4610 - Support standalone build of clang-tidy unittest

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 25 02:51:25 PST 2021


Author: serge-sans-paille
Date: 2021-02-25T11:51:12+01:00
New Revision: f0e461057221ad334cd194211ef4fa31364054e3

URL: https://github.com/llvm/llvm-project/commit/f0e461057221ad334cd194211ef4fa31364054e3
DIFF: https://github.com/llvm/llvm-project/commit/f0e461057221ad334cd194211ef4fa31364054e3.diff

LOG: 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

Added: 
    

Modified: 
    clang-tools-extra/unittests/clang-tidy/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
index 05d330dd8033..4a8d50f01473 100644
--- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -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})


        


More information about the cfe-commits mailing list