diff --git a/llvm/cmake/modules/CrossCompile.cmake b/llvm/cmake/modules/CrossCompile.cmake --- a/llvm/cmake/modules/CrossCompile.cmake +++ b/llvm/cmake/modules/CrossCompile.cmake @@ -112,11 +112,17 @@ endif() set(output_path ${output_path}${LLVM_HOST_EXECUTABLE_SUFFIX}) + # Make chain of preceding actions + if(CMAKE_GENERATOR MATCHES "Visual Studio") + get_property(host_targets GLOBAL PROPERTY ${PROJECT_NAME}_HOST_TARGETS) + set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_HOST_TARGETS ${output_path}) + endif() + llvm_ExternalProject_BuildCmd(build_cmd ${target} ${${PROJECT_NAME}_NATIVE_BUILD} CONFIGURATION Release) add_custom_command(OUTPUT "${output_path}" COMMAND ${build_cmd} - DEPENDS CONFIGURE_${PROJECT_NAME}_NATIVE ${ARG_DEPENDS} + DEPENDS CONFIGURE_${PROJECT_NAME}_NATIVE ${ARG_DEPENDS} ${host_targets} WORKING_DIRECTORY "${${PROJECT_NAME}_NATIVE_BUILD}" COMMENT "Building native ${target}..." USES_TERMINAL) diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -171,14 +171,6 @@ add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE}) set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE) - # Create an artificial dependency between tablegen projects, because they - # compile the same dependencies, thus using the same build folders. - # FIXME: A proper fix requires sequentially chaining tablegens. - if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND - TARGET LLVM-tablegen-host) - add_dependencies(${project}-tablegen-host LLVM-tablegen-host) - endif() - # If we're using the host tablegen, and utils were not requested, we have no # need to build this tablegen. if ( NOT LLVM_BUILD_UTILS )