https://github.com/rossburton created https://github.com/llvm/llvm-project/pull/161952
It's possible to build clang with an existing clang-tblgen (common when cross-compiling, for instance) by setting CLANG_TABLEGEN_EXE. If this is the case there's no need to build it, as it won't be used. >From edbcf9a49d7770cfcd9ac950deb6884e6de712a8 Mon Sep 17 00:00:00 2001 From: Ross Burton <[email protected]> Date: Fri, 3 Oct 2025 20:34:02 +0100 Subject: [PATCH] [clang] Only build clang-tblgen if it is actually needed It's possible to build clang with an existing clang-tblgen (common when cross-compiling, for instance) by setting CLANG_TABLEGEN_EXE. If this is the case there's no need to build it, as it won't be used. --- clang/utils/TableGen/CMakeLists.txt | 61 +++++++++++++++-------------- 1 file changed, 32 insertions(+), 29 deletions(-) diff --git a/clang/utils/TableGen/CMakeLists.txt b/clang/utils/TableGen/CMakeLists.txt index 14f13824e9575..20a7b88ecdbee 100644 --- a/clang/utils/TableGen/CMakeLists.txt +++ b/clang/utils/TableGen/CMakeLists.txt @@ -1,31 +1,34 @@ -set(LLVM_LINK_COMPONENTS Support) +# We only need to build clang-tblgen if we haven't been told to use an existing binary. +if (NOT DEFINED CLANG_TABLEGEN_EXE) + set(LLVM_LINK_COMPONENTS Support) -add_tablegen(clang-tblgen CLANG - DESTINATION "${CLANG_TOOLS_INSTALL_DIR}" - EXPORT Clang - ASTTableGen.cpp - CIRLoweringEmitter.cpp - ClangASTNodesEmitter.cpp - ClangASTPropertiesEmitter.cpp - ClangAttrEmitter.cpp - ClangBuiltinsEmitter.cpp - ClangBuiltinTemplatesEmitter.cpp - ClangCommentCommandInfoEmitter.cpp - ClangCommentHTMLNamedCharacterReferenceEmitter.cpp - ClangCommentHTMLTagsEmitter.cpp - ClangDataCollectorsEmitter.cpp - ClangDiagnosticsEmitter.cpp - ClangOpcodesEmitter.cpp - ClangOpenCLBuiltinEmitter.cpp - ClangOptionDocEmitter.cpp - ClangSACheckersEmitter.cpp - ClangSyntaxEmitter.cpp - ClangTypeNodesEmitter.cpp - MveEmitter.cpp - NeonEmitter.cpp - RISCVVEmitter.cpp - SveEmitter.cpp - TableGen.cpp - ) + add_tablegen(clang-tblgen CLANG + DESTINATION "${CLANG_TOOLS_INSTALL_DIR}" + EXPORT Clang + ASTTableGen.cpp + CIRLoweringEmitter.cpp + ClangASTNodesEmitter.cpp + ClangASTPropertiesEmitter.cpp + ClangAttrEmitter.cpp + ClangBuiltinsEmitter.cpp + ClangBuiltinTemplatesEmitter.cpp + ClangCommentCommandInfoEmitter.cpp + ClangCommentHTMLNamedCharacterReferenceEmitter.cpp + ClangCommentHTMLTagsEmitter.cpp + ClangDataCollectorsEmitter.cpp + ClangDiagnosticsEmitter.cpp + ClangOpcodesEmitter.cpp + ClangOpenCLBuiltinEmitter.cpp + ClangOptionDocEmitter.cpp + ClangSACheckersEmitter.cpp + ClangSyntaxEmitter.cpp + ClangTypeNodesEmitter.cpp + MveEmitter.cpp + NeonEmitter.cpp + RISCVVEmitter.cpp + SveEmitter.cpp + TableGen.cpp + ) -target_link_libraries(clang-tblgen PRIVATE clangSupport_tablegen) + target_link_libraries(clang-tblgen PRIVATE clangSupport_tablegen) +endif() _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
