[llvm] [LLVM][CMake] Build examples for llvm-test-depends (PR #171998)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 08:26:43 PST 2025


https://github.com/aengelke updated https://github.com/llvm/llvm-project/pull/171998

>From 26ec1869c76f6afc79dfa03993282cc403350057 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 12 Dec 2025 12:29:33 +0000
Subject: [PATCH 1/2] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20in?=
 =?UTF-8?q?itial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5-bogner
---
 llvm/test/CMakeLists.txt         | 4 ++--
 llvm/test/Examples/lit.local.cfg | 2 +-
 llvm/test/lit.cfg.py             | 2 +-
 llvm/test/lit.site.cfg.py.in     | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/llvm/test/CMakeLists.txt b/llvm/test/CMakeLists.txt
index e547c3429058b..1a17c97d119bf 100644
--- a/llvm/test/CMakeLists.txt
+++ b/llvm/test/CMakeLists.txt
@@ -13,7 +13,7 @@ llvm_canonicalize_cmake_booleans(
   LLVM_LINK_LLVM_DYLIB
   LLVM_TOOL_LTO_BUILD
   LLVM_USE_INTEL_JITEVENTS
-  LLVM_BUILD_EXAMPLES
+  LLVM_INCLUDE_EXAMPLES
   LLVM_ENABLE_PLUGINS
   LLVM_BYE_LINK_INTO_TOOLS
   LLVM_EXAMPLEIRTRANSFORMS_LINK_INTO_TOOLS
@@ -186,7 +186,7 @@ if (TARGET llvm-mt)
   list(APPEND LLVM_TEST_DEPENDS llvm-mt)
 endif ()
 
-if(LLVM_BUILD_EXAMPLES)
+if(LLVM_INCLUDE_EXAMPLES)
   list(APPEND LLVM_TEST_DEPENDS
     Kaleidoscope-Ch3
     Kaleidoscope-Ch4
diff --git a/llvm/test/Examples/lit.local.cfg b/llvm/test/Examples/lit.local.cfg
index f9127daf813cb..3e19c6cbb0cec 100644
--- a/llvm/test/Examples/lit.local.cfg
+++ b/llvm/test/Examples/lit.local.cfg
@@ -1,4 +1,4 @@
-if not config.build_examples or sys.platform in ["win32"]:
+if not config.include_examples or sys.platform in ["win32"]:
     config.unsupported = True
 
 # Test discovery should ignore subdirectories that contain test inputs.
diff --git a/llvm/test/lit.cfg.py b/llvm/test/lit.cfg.py
index 1dfa280e6b82a..26fa8078a1e9b 100644
--- a/llvm/test/lit.cfg.py
+++ b/llvm/test/lit.cfg.py
@@ -511,7 +511,7 @@ def enable_ptxas(ptxas_executable):
 if config.has_plugins:
     config.available_features.add("plugins")
 
-if config.build_examples:
+if config.include_examples:
     config.available_features.add("examples")
 
 if config.linked_bye_extension:
diff --git a/llvm/test/lit.site.cfg.py.in b/llvm/test/lit.site.cfg.py.in
index c5cb7160a3d40..193f351ef52ef 100644
--- a/llvm/test/lit.site.cfg.py.in
+++ b/llvm/test/lit.site.cfg.py.in
@@ -40,7 +40,7 @@ config.have_curl = @LLVM_ENABLE_CURL@
 config.have_httplib = @LLVM_ENABLE_HTTPLIB@
 config.have_dia_sdk = @LLVM_ENABLE_DIA_SDK@
 config.enable_ffi = @LLVM_ENABLE_FFI@
-config.build_examples = @LLVM_BUILD_EXAMPLES@
+config.include_examples = @LLVM_INCLUDE_EXAMPLES@
 config.enable_backtrace = @ENABLE_BACKTRACES@
 config.enable_threads = @LLVM_ENABLE_THREADS@
 config.build_shared_libs = @BUILD_SHARED_LIBS@

>From 7ef4f1a210e8c70c34240cd7a7d913e7dabd2075 Mon Sep 17 00:00:00 2001
From: Alexis Engelke <engelke at in.tum.de>
Date: Fri, 12 Dec 2025 16:26:30 +0000
Subject: [PATCH 2/2] update docs for LLVM_BUILD_EXAMPLES

Created using spr 1.3.5-bogner
---
 llvm/docs/CMake.rst | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/llvm/docs/CMake.rst b/llvm/docs/CMake.rst
index de8be0ad2dded..ec181999aec57 100644
--- a/llvm/docs/CMake.rst
+++ b/llvm/docs/CMake.rst
@@ -366,9 +366,10 @@ its enabled sub-projects. Nearly all of these variable names begin with
   ``LLVM_ENABLE_SPHINX`` and ``LLVM_ENABLE_DOXYGEN``.
 
 **LLVM_BUILD_EXAMPLES**:BOOL
-  Build LLVM examples. Defaults to OFF. Targets for building each example are
-  generated in any case. See documentation for *LLVM_BUILD_TOOLS* above for more
-  details.
+  Include LLVM examples in the 'all' build target and install them as part of
+  the ``install`` target. Defaults to OFF. Targets for building examples are
+  still generated, this is controlled by *LLVM_INCLUDE_EXAMPLES*. Note that some
+  examples might still be built as dependencies for tests.
 
 **LLVM_BUILD_INSTRUMENTED_COVERAGE**:BOOL
   If enabled, `source-based code coverage



More information about the llvm-commits mailing list