[llvm] [CMake] Forward CLANG_ENABLE_CIR to native tool builds (PR #222771)

Mehdi Amini via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 13:58:45 PDT 2026


https://github.com/joker-eph created https://github.com/llvm/llvm-project/pull/222771

Cross-compilation and optimized TableGen builds configure a separate native build. Commit 23de87dae769 changed that configuration to forward LLVM_REQUESTED_PROJECTS instead of the effective LLVM_ENABLE_PROJECTS dependency closure.

Commit b1b68627b9da then made MLIR an implicit dependency of ClangIR. The native configuration consequently received the clang project but not MLIR, because CLANG_ENABLE_CIR was not forwarded and the dependency could not be reconstructed.

With LLVM_OPTIMIZED_TABLEGEN enabled, the outer build attempted to build mlir-tblgen in this native build, where the target did not exist.

Forward CLANG_ENABLE_CIR to the native configuration so it derives the same dependency-only MLIR project and provides mlir-tblgen.

>From bef680923bbc45d12c8937e4b151064d79586533 Mon Sep 17 00:00:00 2001
From: Mehdi Amini <joker.eph at gmail.com>
Date: Thu, 10 Sep 2026 22:45:21 +0200
Subject: [PATCH] [CMake] Forward ClangIR to native tool builds

Cross-compilation and optimized TableGen builds configure a separate native build. Commit 23de87dae7695634bb618e188912de11267f1dd0 changed that configuration to forward LLVM_REQUESTED_PROJECTS instead of the effective LLVM_ENABLE_PROJECTS dependency closure.

Commit b1b68627b9da8d4bbdf9a39bb2bde52dd6ce8bf3 then made MLIR an implicit dependency of ClangIR. The native configuration consequently received the clang project but not MLIR, because CLANG_ENABLE_CIR was not forwarded and the dependency could not be reconstructed.

With LLVM_OPTIMIZED_TABLEGEN enabled, the outer build attempted to build mlir-tblgen in this native build, where the target did not exist.

Forward CLANG_ENABLE_CIR to the native configuration so it derives the same dependency-only MLIR project and provides mlir-tblgen.
---
 llvm/cmake/modules/CrossCompile.cmake | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake
index dc222610dd81b..a4c43d09c8386 100644
--- a/llvm/cmake/modules/CrossCompile.cmake
+++ b/llvm/cmake/modules/CrossCompile.cmake
@@ -102,6 +102,8 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
         -DLLVM_ENABLE_PROJECTS="${llvm_enable_projects_arg}"
         -DLLVM_EXTERNAL_PROJECTS="${llvm_external_projects_arg}"
         -DLLVM_ENABLE_RUNTIMES="${llvm_enable_runtimes_arg}"
+        # Forward options used to derive implicit project dependencies.
+        -DCLANG_ENABLE_CIR="${CLANG_ENABLE_CIR}"
         ${external_project_source_dirs}
         -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}"
         -DLLVM_INCLUDE_BENCHMARKS=OFF



More information about the llvm-commits mailing list