[clang] a1feacb - Add build option CLANG_INCLUDE_EXAMPLES (#187317)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 10 19:27:40 PDT 2026


Author: Jade Abraham
Date: 2026-07-11T04:27:34+02:00
New Revision: a1feacb3e4fdf447ca15052cf4124d06691bf56a

URL: https://github.com/llvm/llvm-project/commit/a1feacb3e4fdf447ca15052cf4124d06691bf56a
DIFF: https://github.com/llvm/llvm-project/commit/a1feacb3e4fdf447ca15052cf4124d06691bf56a.diff

LOG: Add build option CLANG_INCLUDE_EXAMPLES (#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)

Signed-off-by: Jade Abraham <jademabraham17 at gmail.com>

Added: 
    

Modified: 
    clang/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 20276a034d50a..89f584c5dceaa 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -560,7 +560,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