Index: llvm/cmake/modules/CrossCompile.cmake =================================================================== --- llvm/cmake/modules/CrossCompile.cmake +++ llvm/cmake/modules/CrossCompile.cmake @@ -41,10 +41,15 @@ if (buildtype) set(build_type_flags "-DCMAKE_BUILD_TYPE=${buildtype}") endif() + if (LLVM_EXTERNAL_CLANG_SOURCE_DIR) + # Propagate LLVM_EXTERNAL_CLANG_SOURCE_DIR so that clang-tblgen can be built + set(external_clang_dir "-DLLVM_EXTERNAL_CLANG_SOURCE_DIR=${LLVM_EXTERNAL_CLANG_SOURCE_DIR}") + endif() execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags} -G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD} ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR} -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE + ${external_clang_dir} WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} ) endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD})