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 @@ -125,7 +125,7 @@ if(LLVM_USE_HOST_TOOLS) if( ${${project}_TABLEGEN} STREQUAL "${target}" ) - build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target}) + build_native_tool(${target} ${project}_TABLEGEN_EXE) set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE) add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE}) @@ -138,6 +138,12 @@ 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 ) + set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON) + endif() endif() endif()