[llvm] [cmake] Pass PYTHON_EXECUTABLE to native builds (PR #163574)

Ross Burton via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 08:07:19 PDT 2025


https://github.com/rossburton created https://github.com/llvm/llvm-project/pull/163574

Ensure that the nested native build uses the same python interpreter as the main build, in case the python that CMake detects first is not the python that the user has specified explicitly.

Original fix by Anuj Mittal <anuj.mittal at intel.com>.

>From 7bdfaf3d42b5f718cbdfa2d0ce9beb6adfa099f4 Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton at arm.com>
Date: Wed, 15 Oct 2025 15:21:16 +0100
Subject: [PATCH] [cmake] Pass PYTHON_EXECUTABLE to native builds

Ensure that the nested native build uses the same python interpreter as
the main build, in case the python that CMake detects first is not the
python that the user has specified explicitly.

Original fix by Anuj Mittal <anuj.mittal at intel.com>.
---
 llvm/cmake/modules/CrossCompile.cmake | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake
index bfbd9cfd4063f..2a69c5133c56f 100644
--- a/llvm/cmake/modules/CrossCompile.cmake
+++ b/llvm/cmake/modules/CrossCompile.cmake
@@ -101,6 +101,7 @@ function(llvm_create_cross_target project_name target_name toolchain buildtype)
         -DLLVM_INCLUDE_BENCHMARKS=OFF
         -DLLVM_INCLUDE_TESTS=OFF
         -DLLVM_TABLEGEN_FLAGS="${LLVM_TABLEGEN_FLAGS}"
+        -DPYTHON_EXECUTABLE="${PYTHON_EXECUTABLE}"
         ${build_type_flags} ${linker_flag} ${external_clang_dir} ${libc_flags}
         ${ARGN}
     WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD}



More information about the llvm-commits mailing list