diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -77,6 +77,16 @@ set_enable_per_target_runtime_dir() + get_cmake_property(variableNames VARIABLES) + foreach(variableName ${variableNames}) + string(FIND "${variableName}" "BUILTINS_default" out) + if("${out}" EQUAL 0) + string(REPLACE "BUILTINS_default_" "" new_name ${variableName}) + string(REPLACE ";" "|" new_value "${${variableName}}") + list(APPEND default_target_extra_args "-D${new_name}=${new_value}") + endif() + endforeach() + llvm_ExternalProject_Add(builtins ${compiler_rt_path}/lib/builtins DEPENDS ${ARG_DEPENDS} @@ -88,6 +98,7 @@ -DCMAKE_ASM_COMPILER_WORKS=ON ${COMMON_CMAKE_ARGS} ${BUILTINS_CMAKE_ARGS} + ${default_target_extra_args} PASSTHROUGH_PREFIXES COMPILER_RT DARWIN SANITIZER @@ -214,6 +225,17 @@ endif() endforeach() + set(default_target_extra_args ${ARG_CMAKE_ARGS}) + get_cmake_property(variableNames VARIABLES) + foreach(variableName ${variableNames}) + string(FIND "${variableName}" "RUNTIMES_default_" out) + if("${out}" EQUAL 0) + string(REPLACE "RUNTIMES_default_" "" new_name ${variableName}) + string(REPLACE ";" "|" new_value "${${variableName}}") + list(APPEND default_target_extra_args "-D${new_name}=${new_value}") + endif() + endforeach() + if(LLVM_INCLUDE_TESTS) set_property(GLOBAL APPEND PROPERTY LLVM_ALL_LIT_TESTSUITES "@${LLVM_BINARY_DIR}/runtimes/runtimes-bins/lit.tests") list(APPEND test_targets runtimes-test-depends check-runtimes) @@ -236,7 +258,7 @@ -DCMAKE_ASM_COMPILER_WORKS=ON ${COMMON_CMAKE_ARGS} ${RUNTIMES_CMAKE_ARGS} - ${ARG_CMAKE_ARGS} + ${default_target_extra_args} PASSTHROUGH_PREFIXES LLVM_ENABLE_RUNTIMES LLVM_USE_LINKER ${ARG_PREFIXES}