Skip to content

Commit 7420b89

Browse files
smeenaizahiraam
authored andcommitted
[runtimes] Add a mechanism to use cache files for a runtimes build
Projects like libc++ include their own cache files, and it's convenient to just be able to reuse those cache files as part of a runtimes build instead of having to duplicate the settings inside a special runtimes cache file (which will inevitably get out of sync). I'm not completely happy about overloading the existing argument passing behavior based on the argument name, but I also couldn't think of a good alternative. Suggestions are welcome. Reviewed By: phosek Differential Revision: https://reviews.llvm.org/D158791
1 parent b049249 commit 7420b89

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

llvm/runtimes/CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,14 @@ function(builtin_register_target compiler_rt_path name)
105105
string(FIND "${variable_name}" "BUILTINS_${name}" out)
106106
if("${out}" EQUAL 0)
107107
string(REPLACE "BUILTINS_${name}_" "" new_name ${variable_name})
108-
string(REPLACE ";" "|" new_value "${${variable_name}}")
109-
list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
108+
if(new_name STREQUAL CACHE_FILES)
109+
foreach(cache IN LISTS ${variable_name})
110+
list(APPEND ${name}_extra_args -C ${cache})
111+
endforeach()
112+
else()
113+
string(REPLACE ";" "|" new_value "${${variable_name}}")
114+
list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
115+
endif()
110116
endif()
111117
endforeach()
112118

@@ -326,8 +332,14 @@ function(runtime_register_target name)
326332
string(FIND "${variable_name}" "RUNTIMES_${extra_name}_" out)
327333
if("${out}" EQUAL 0)
328334
string(REPLACE "RUNTIMES_${extra_name}_" "" new_name ${variable_name})
329-
string(REPLACE ";" "|" new_value "${${variable_name}}")
330-
list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
335+
if(new_name STREQUAL CACHE_FILES)
336+
foreach(cache IN LISTS ${variable_name})
337+
list(APPEND ${name}_extra_args -C ${cache})
338+
endforeach()
339+
else()
340+
string(REPLACE ";" "|" new_value "${${variable_name}}")
341+
list(APPEND ${name}_extra_args "-D${new_name}=${new_value}")
342+
endif()
331343
endif()
332344
endforeach()
333345
endforeach()

0 commit comments

Comments
 (0)