[llvm] [cmake] Add LLVM_TARGET_TRIPLE_ENV to LLVMConfig.cmake.in (PR #158303)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 12 07:35:19 PDT 2025


https://github.com/parabola94 created https://github.com/llvm/llvm-project/pull/158303

LLVM has a mechanism to switch the default target: LLVM_TARGET_TRIPLE_ENV. For example, regression tests with lit use this CMake variable. It matters only when building LLVM, not the other projects. Therefore, if they are built standalone, the value of the CMake variable should be propagated. In fact, however, it is not.
This patch fixes it.

>From 2f2dbd197c8a11786fde5ef38688463083284c54 Mon Sep 17 00:00:00 2001
From: parabola94 <heavybaby5000 at toki.waseda.jp>
Date: Fri, 12 Sep 2025 23:03:30 +0900
Subject: [PATCH] [cmake] Add LLVM_TARGET_TRIPLE_ENV to LLVMConfig.cmake.in

LLVM has a mechanism to switch the default target: LLVM_TARGET_TRIPLE_ENV.
For example, regression tests with lit use this CMake variable.
It matters only when building LLVM, not the other projects.
Therefore, if they are built standalone, the value of the CMake variable should be propagated.
In fact, however, it is not.
This patch fixes it.
---
 llvm/cmake/modules/LLVMConfig.cmake.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
index c15b9576cd5d5..70c807abea98a 100644
--- a/llvm/cmake/modules/LLVMConfig.cmake.in
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in
@@ -36,6 +36,8 @@ set(LLVM_TARGETS_WITH_JIT @LLVM_TARGETS_WITH_JIT@)
 
 set(LLVM_TARGET_TRIPLE "@LLVM_TARGET_TRIPLE@")
 
+set(LLVM_TARGET_TRIPLE_ENV "@LLVM_TARGET_TRIPLE_ENV@")
+
 set(LLVM_HOST_TRIPLE "@LLVM_HOST_TRIPLE@")
 
 set(LLVM_ABI_BREAKING_CHECKS @LLVM_ABI_BREAKING_CHECKS@)



More information about the llvm-commits mailing list