[clang] [clang] Only build c-index-test when clang tests are included (PR #151157)
David Spickett via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 29 07:23:05 PDT 2025
https://github.com/DavidSpickett updated https://github.com/llvm/llvm-project/pull/151157
>From 714a9cb319a8946fa670c7e8bbe7f29f847fa45f Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 29 Jul 2025 14:17:56 +0000
Subject: [PATCH 1/2] [clang] Only build c-index-test when clang tests are
included
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.
---
clang/tools/CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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.
>From 95aeea365cdfcf95c2acac0bd666e58778f2de2e Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Tue, 29 Jul 2025 14:22:32 +0000
Subject: [PATCH 2/2] apinotes-test too
---
clang/tools/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/tools/CMakeLists.txt b/clang/tools/CMakeLists.txt
index 99292f3d6ca9a..0e2630665114d 100644
--- a/clang/tools/CMakeLists.txt
+++ b/clang/tools/CMakeLists.txt
@@ -2,7 +2,6 @@ create_subdirectory_options(CLANG TOOL)
add_clang_subdirectory(diagtool)
add_clang_subdirectory(driver)
-add_clang_subdirectory(apinotes-test)
if(CLANG_ENABLE_CIR)
add_clang_subdirectory(cir-opt)
add_clang_subdirectory(cir-translate)
@@ -25,6 +24,7 @@ endif()
if(CLANG_INCLUDE_TESTS)
add_clang_subdirectory(c-index-test)
+ add_clang_subdirectory(apinotes-test)
endif()
add_clang_subdirectory(clang-refactor)
More information about the cfe-commits
mailing list