Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -621,10 +621,15 @@ LLVM_ENABLE_PROJECTS LLVM_ENABLE_RUNTIMES) - # We don't need to depend on compiler-rt if we're building instrumented + # We don't need to depend on compiler-rt/libcxx if we're building instrumented # because the next stage will use the same compiler used to build this stage. - if(TARGET compiler-rt AND NOT LLVM_BUILD_INSTRUMENTED) - add_dependencies(clang-bootstrap-deps compiler-rt) + if(NOT LLVM_BUILD_INSTRUMENTED) + if(TARGET compiler-rt) + add_dependencies(clang-bootstrap-deps compiler-rt) + endif() + if(TARGET cxx-headers) + add_dependencies(clang-bootstrap-deps cxx-headers) + endif() endif() set(C_COMPILER "clang") Index: runtime/CMakeLists.txt =================================================================== --- runtime/CMakeLists.txt +++ runtime/CMakeLists.txt @@ -58,8 +58,12 @@ endif() endforeach() + if(TARGET cxx-headers) + set(COMPILER_RT_LIBCXX_DEPENDENCY "cxx-headers") + endif() + ExternalProject_Add(compiler-rt - DEPENDS llvm-config clang + DEPENDS llvm-config clang ${COMPILER_RT_LIBCXX_DEPENDENCY} PREFIX ${COMPILER_RT_PREFIX} SOURCE_DIR ${COMPILER_RT_SRC_ROOT} STAMP_DIR ${STAMP_DIR}