[llvm] [runtimes] Escape list separators when forwarding search paths (PR #216169)

Larry Meadows via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 21 12:46:52 PDT 2026


https://github.com/lfmeadow updated https://github.com/llvm/llvm-project/pull/216169

>From 896ca093c939e67eebbab1d1cb85a75944fa41e2 Mon Sep 17 00:00:00 2001
From: Larry Meadows <Lawrence.Meadows at amd.com>
Date: Thu, 13 Aug 2026 15:13:01 -0500
Subject: [PATCH 1/2] [runtimes] Escape list separators when forwarding search
 paths

CMAKE_PREFIX_PATH and CMAKE_PROGRAM_PATH are forwarded to the runtimes
sub-build as -D arguments, but a CMake list is just a semicolon-separated
string, so list(APPEND) splits a multi-entry path across several elements.
The sub-build is then configured with only the first entry, and the rest
become stray positional arguments to cmake.

Join the entries with $<SEMICOLON> so each path arrives as a single
argument. LIST_SEPARATOR, which llvm_ExternalProject_Add already sets,
does not help here because the split happens at the CMake list level
before ExternalProject sees the value.

Co-authored-by: Cursor <cursoragent at cursor.com>
---
 llvm/runtimes/CMakeLists.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index c2607393d1bb9..dfdcb0f0f5ab5 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -581,13 +581,18 @@ if(build_runtimes)
   endif()
 
   # Forward user-provived system configuration to runtimes for requirement introspection.
+  # These are lists, so their separators have to survive being passed on the
+  # sub-build's command line; an unescaped ';' would split them into separate
+  # arguments.
   # CMAKE_PREFIX_PATH is the search path for CMake packages.
   if(CMAKE_PREFIX_PATH)
-    list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}")
+    string(JOIN "$<SEMICOLON>" escaped_prefix_path ${CMAKE_PREFIX_PATH})
+    list(APPEND extra_cmake_args "-DCMAKE_PREFIX_PATH=${escaped_prefix_path}")
   endif()
   # CMAKE_PROGRAM_PATH is the search path for executables such as python.
   if(CMAKE_PROGRAM_PATH)
-    list(APPEND extra_cmake_args "-DCMAKE_PROGRAM_PATH=${CMAKE_PROGRAM_PATH}")
+    string(JOIN "$<SEMICOLON>" escaped_program_path ${CMAKE_PROGRAM_PATH})
+    list(APPEND extra_cmake_args "-DCMAKE_PROGRAM_PATH=${escaped_program_path}")
   endif()
 
   set(libclc_enabled FALSE)

>From 4dc1df85203311c9f6d7b91de40683ba29b20037 Mon Sep 17 00:00:00 2001
From: Larry Meadows <lmeadows at amd.com>
Date: Fri, 21 Aug 2026 12:44:44 -0700
Subject: [PATCH 2/2] Typo in comment

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot at users.noreply.github.com>
---
 llvm/runtimes/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index dfdcb0f0f5ab5..9bc0196b4262c 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -580,7 +580,7 @@ if(build_runtimes)
     endif()
   endif()
 
-  # Forward user-provived system configuration to runtimes for requirement introspection.
+  # Forward user-provided system configuration to runtimes for requirement introspection.
   # These are lists, so their separators have to survive being passed on the
   # sub-build's command line; an unescaped ';' would split them into separate
   # arguments.



More information about the llvm-commits mailing list