[clang] Add build option CLANG_INCLUDE_EXAMPLES (PR #187317)
Jade Abraham via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 18 09:15:31 PDT 2026
https://github.com/jabraham17 created https://github.com/llvm/llvm-project/pull/187317
Adds a new build option for clang, CLANG_INCLUDE_EXAMPLES, which controls if the examples directory is included in the build. It defaults to the value for LLVM_INCLUDE_EXAMPLES (same as CLANG_INCLUDE_DOCS and CLANG_INCLUDE_TESTS)
>From cd7cb0b9fca9c5a03f86f1ee8490d526d1981a62 Mon Sep 17 00:00:00 2001
From: Jade Abraham <jade.abraham at hpe.com>
Date: Wed, 18 Mar 2026 11:14:00 -0500
Subject: [PATCH] add build option CLANG_INCLUDE_EXAMPLES to match
LLVM_INCLUDE_EXAMPLES
Signed-off-by: Jade Abraham <jade.abraham at hpe.com>
---
clang/CMakeLists.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index f0d10603374b9..c0e6ef5b433bf 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -508,7 +508,12 @@ add_subdirectory(tools)
add_subdirectory(runtime)
option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF)
-add_subdirectory(examples)
+option(CLANG_INCLUDE_EXAMPLES
+ "Generate build targets for the Clang examples."
+ ${LLVM_INCLUDE_EXAMPLES})
+if (CLANG_INCLUDE_EXAMPLES)
+ add_subdirectory(examples)
+endif()
if(APPLE)
# this line is needed as a cleanup to ensure that any CMakeCaches with the old
More information about the cfe-commits
mailing list