llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Deepesh Varatharajan (DeepeshWR)
<details>
<summary>Changes</summary>
clang-tools-extra tests depend on the llvm-bcanalyzer CMake target, which
exists in LLVM's CMake project but is not visible when Clang is built
separately from LLVM. This causes CMake errors when CLANG_INCLUDE_TESTS is ON
but the LLVM tools are not available.
This patch introduces CLANG_TOOLS_EXTRA_INCLUDE_TESTS as a separate CMake
option to control clang-tools-extra tests independently, allowing users to
build Clang with tests enabled (CLANG_INCLUDE_TESTS=ON) while disabling
clang-tools-extra tests (CLANG_TOOLS_EXTRA_INCLUDE_TESTS=OFF) when building
Clang separately from LLVM.
Without this patch, the following error occurs when CLANG_INCLUDE_TESTS is ON:
```
CMake Error at AddLLVM.cmake:2113 (add_dependencies):
The dependency target "llvm-bcanalyzer" of target
"check-clang-extra-clang-tidy-infrastructure-..." does not exist.
```
---
Full diff: https://github.com/llvm/llvm-project/pull/215761.diff
3 Files Affected:
- (modified) clang-tools-extra/CMakeLists.txt (+4-2)
- (modified) clang-tools-extra/clangd/CMakeLists.txt (+1-1)
- (modified) clang-tools-extra/include-cleaner/CMakeLists.txt (+1-1)
``````````diff
diff --git a/clang-tools-extra/CMakeLists.txt b/clang-tools-extra/CMakeLists.txt
index 87050db4e0e75..3278dcee168f8 100644
--- a/clang-tools-extra/CMakeLists.txt
+++ b/clang-tools-extra/CMakeLists.txt
@@ -7,8 +7,10 @@ option(CLANG_TIDY_ENABLE_STATIC_ANALYZER
"Include static analyzer checks in clang-tidy" ON)
option(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
"Enable query-based custom checks in clang-tidy" ON)
+option(CLANG_TOOLS_EXTRA_INCLUDE_TESTS
+ "Generate build targets for the Clang Extra Tools unit tests." ON)
-if(CLANG_INCLUDE_TESTS)
+if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS)
umbrella_lit_testsuite_begin(check-clang-tools)
option(CLANG_TOOLS_TEST_USE_VG "Run Clang tools' tests under Valgrind" OFF)
@@ -45,7 +47,7 @@ if (CLANG_ENABLE_CLANGD)
endif()
# Add the common testsuite after all the tools.
-if(CLANG_INCLUDE_TESTS)
+if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(unittests)
umbrella_lit_testsuite_end(check-clang-tools)
diff --git a/clang-tools-extra/clangd/CMakeLists.txt
b/clang-tools-extra/clangd/CMakeLists.txt
index 9fa7d92d8374c..6e1597a607ed9 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -218,7 +218,7 @@ endif()
option(CLANGD_BUILD_DEXP "Build the dexp tool as part of Clangd" ON)
llvm_canonicalize_cmake_booleans(CLANGD_BUILD_DEXP)
-if(CLANG_INCLUDE_TESTS)
+if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(unittests)
endif()
diff --git a/clang-tools-extra/include-cleaner/CMakeLists.txt
b/clang-tools-extra/include-cleaner/CMakeLists.txt
index dc147f9ca08df..4855577dec98d 100644
--- a/clang-tools-extra/include-cleaner/CMakeLists.txt
+++ b/clang-tools-extra/include-cleaner/CMakeLists.txt
@@ -1,7 +1,7 @@
include_directories(include)
add_subdirectory(lib)
add_subdirectory(tool)
-if(CLANG_INCLUDE_TESTS)
+if(CLANG_TOOLS_EXTRA_INCLUDE_TESTS)
add_subdirectory(test)
add_subdirectory(unittests)
endif()
``````````
</details>
https://github.com/llvm/llvm-project/pull/215761
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits