[llvm] [cmake][runtimes] Pass variable type for passthrough CMake options (PR #227662)
Raul Tambre via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 30 04:25:30 PDT 2026
https://github.com/tambry created https://github.com/llvm/llvm-project/pull/227662
Previously reverted because of https://github.com/llvm/llvm-project/pull/198505#issuecomment-4496493320.
However there's insufficient information to replicate or fix the non-upstream build issue so I'll go ahead with reapplying in the hopes that maybe it's magically resolved itself.
Passing the types affects the handling of `PATH` cache variables. The motivating case is setting `COMPILER_RT_INSTALL_LIBRARY_DIR` without `CMAKE_BINARY_DIR` getting prepended to it.
>From 4da765d6fa02214372f93fc40a0c73966500a1a8 Mon Sep 17 00:00:00 2001
From: Raul Tambre <raul at tambre.ee>
Date: Tue, 19 May 2026 14:59:26 +0300
Subject: [PATCH] [cmake][runtimes] Pass variable type for passthrough CMake
options
Passing the types affects the handling of `PATH` cache variables.
The motivating case is setting `COMPILER_RT_INSTALL_LIBRARY_DIR` without `CMAKE_BINARY_DIR` getting prepended to it.
Revert-Of: 313ab4dc3b3a5f4c14079c82806c1f28975f724f
Re-Apply-Of: 2e06e008a7b44fab5c0d7fbc4331c696b5e19b06
---
llvm/runtimes/CMakeLists.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index fcb85ec96e265..b87bd969f9bb2 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -107,6 +107,14 @@ macro(append_passthrough_options out type names)
list(APPEND ${out} -C ${cache})
endforeach()
else()
+ # Type is important for cache variables.
+ # For example PATH variables will be made relative to CMAKE_BINARY_DIR
+ # at the point of set(CACHE) if the type isn't passed along.
+ get_property(type CACHE ${variable_name} PROPERTY TYPE)
+ if(NOT type STREQUAL "UNINITIALIZED")
+ string(APPEND new_name ":${type}")
+ endif()
+
string(REPLACE ";" "|" new_value "${${variable_name}}")
list(APPEND ${out} "-D${new_name}=${new_value}")
endif()
More information about the llvm-commits
mailing list