[llvm] 7068818 - [cmake] Optionally install clang-tblgen to aid cross-compiling

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 00:43:51 PST 2023


Author: James Le Cuirot
Date: 2023-01-12T09:43:33+01:00
New Revision: 706881825b2470c7176e07355b6ab54d8b4c5f95

URL: https://github.com/llvm/llvm-project/commit/706881825b2470c7176e07355b6ab54d8b4c5f95
DIFF: https://github.com/llvm/llvm-project/commit/706881825b2470c7176e07355b6ab54d8b4c5f95.diff

LOG: [cmake] Optionally install clang-tblgen to aid cross-compiling

clang-tblgen is required to cross-compile clang itself. Unlike before,
most of the infrastructure is in place to do this now, and the only
thing preventing it is LLVM_BUILD_UTILS, which doesn't apply to Clang.

I thought about changing this to ${project}_BUILD_UTILS and adding
a CLANG_BUILD_UTILS option, but there seems little point for just one tool.

Instead, it checks whether clang-tblgen was explicitly requested in
LLVM_DISTRIBUTION_COMPONENTS, which is good enough for Gentoo and
other distributions.

Closes https://github.com/llvm/llvm-project/issues/20282.

Differential Revision: https://reviews.llvm.org/D141092

Added: 
    

Modified: 
    llvm/cmake/modules/TableGen.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 59f6a1466078f..c165728cf18e4 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -190,7 +190,8 @@ macro(add_tablegen target project)
     endif()
   endif()
 
-  if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
+  if (ADD_TABLEGEN_DESTINATION AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND
+      (LLVM_BUILD_UTILS OR ${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS))
     set(export_arg)
     if(ADD_TABLEGEN_EXPORT)
       get_target_export_arg(${target} ${ADD_TABLEGEN_EXPORT} export_arg)


        


More information about the llvm-commits mailing list