]> granicus.if.org Git - clang/commitdiff
[clang] [unittest] Import LLVMTestingSupport if necessary
authorMichal Gorny <mgorny@gentoo.org>
Thu, 12 Sep 2019 13:06:12 +0000 (13:06 +0000)
committerMichal Gorny <mgorny@gentoo.org>
Thu, 12 Sep 2019 13:06:12 +0000 (13:06 +0000)
Add LLVMTestingSupport directory from LLVM_MAIN_SRC_DIR when building
clang stand-alone and LLVMTestingSupport library is not present.  This
is needed to fix stand-alone builds without clang-tools-extra.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@371733 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/CMakeLists.txt

index 9a41000cf438baf872ab067f071403d79b726b00..4c222e24599f0d2fe8730a1b82afe9669e9cab8a 100644 (file)
@@ -1,6 +1,15 @@
 add_custom_target(ClangUnitTests)
 set_target_properties(ClangUnitTests PROPERTIES FOLDER "Clang tests")
 
+if(CLANG_BUILT_STANDALONE)
+  # LLVMTestingSupport library is needed for some of the unittests.
+  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()
+
 # add_clang_unittest(test_dirname file1.cpp file2.cpp)
 #
 # Will compile the list of files together and link against the clang