[clang] [clang] Only build c-index-test when clang tests are included (PR #151157)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 29 07:22:07 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: David Spickett (DavidSpickett)

<details>
<summary>Changes</summary>

c-index-test is only used for testing, and it's used in tests that are already guarded by CLANG_INCLUDE_TESTS in clang/CMakeLists.txt.

This change enables us to do builds with LLVM_INSTALL_TOOLCHAIN_ONLY=OFF, and CLANG_INCLUDE_TESTS=OFF, which contain the required files to build other bits of llvm-project standalone, but does not include c-index-test which we have no need for.

---
Full diff: https://github.com/llvm/llvm-project/pull/151157.diff


1 Files Affected:

- (modified) clang/tools/CMakeLists.txt (+3-1) 


``````````diff
diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index 50e3d694236ac..99292f3d6ca9a 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -23,7 +23,9 @@ if(HAVE_CLANG_REPL_SUPPORT)
   add_clang_subdirectory(clang-repl)
 endif()
 
-add_clang_subdirectory(c-index-test)
+if(CLANG_INCLUDE_TESTS)
+  add_clang_subdirectory(c-index-test)
+endif()
 
 add_clang_subdirectory(clang-refactor)
 # For MinGW/Cygwin we only enable shared library if LLVM_LINK_LLVM_DYLIB=ON.

``````````

</details>


https://github.com/llvm/llvm-project/pull/151157


More information about the cfe-commits mailing list