Index: llvm/runtimes/CMakeLists.txt =================================================================== --- llvm/runtimes/CMakeLists.txt +++ llvm/runtimes/CMakeLists.txt @@ -211,8 +211,11 @@ endif() function(builtin_default_target compiler_rt_path) + cmake_parse_arguments(ARG "" "" "DEPS" ${ARGN}) + llvm_ExternalProject_Add(builtins ${compiler_rt_path}/lib/builtins + DEPENDS ${ARG_DEPS} CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR} -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR} -DLLVM_DEFAULT_TARGET_TRIPLE=${TARGET_TRIPLE} @@ -227,6 +230,8 @@ endfunction() function(builtin_register_target compiler_rt_path target) + cmake_parse_arguments(ARG "" "" "DEPS" ${ARGN}) + string(REPLACE "-" ";" builtin_target_list ${target}) foreach(item ${builtin_target_list}) string(TOLOWER "${item}" item_lower) @@ -245,6 +250,7 @@ llvm_ExternalProject_Add(builtins-${target} ${compiler_rt_path}/lib/builtins + DEPENDS ${ARG_DEPS} CMAKE_ARGS -DLLVM_LIBRARY_OUTPUT_INTDIR=${LLVM_LIBRARY_DIR} -DLLVM_RUNTIME_OUTPUT_INTDIR=${LLVM_TOOLS_BINARY_DIR} -DLLVM_DEFAULT_TARGET_TRIPLE=${target} @@ -266,10 +272,10 @@ get_compiler_rt_path(compiler_rt_path) if(compiler_rt_path) if(NOT LLVM_BUILTIN_TARGETS) - builtin_default_target(${compiler_rt_path}) + builtin_default_target(${compiler_rt_path} DEPS clang-headers) else() if("default" IN_LIST LLVM_BUILTIN_TARGETS) - builtin_default_target(${compiler_rt_path}) + builtin_default_target(${compiler_rt_path} DEPS clang-headers) list(REMOVE_ITEM LLVM_BUILTIN_TARGETS "default") else() add_custom_target(builtins) @@ -278,7 +284,7 @@ endif() foreach(target ${LLVM_BUILTIN_TARGETS}) - builtin_register_target(${compiler_rt_path} ${target}) + builtin_register_target(${compiler_rt_path} ${target} DEPS clang-headers) add_dependencies(builtins builtins-${target}) add_dependencies(install-builtins install-builtins-${target})