[PATCH] D141196: [cmake] Don't require third-party components when cross-compiling

James Le Cuirot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 7 06:30:53 PST 2023


chewi created this revision.
chewi added a reviewer: chandlerc.
chewi added a project: LLVM.
Herald added a project: All.
chewi requested review of this revision.
Herald added a subscriber: llvm-commits.

It is possible to build LLVM with just the "llvm" and "cmake" components checked out. This requires disabling the `LLVM_INCLUDE_BENCHMARKS` and `LLVM_INCLUDE_TESTS` options. These options are not passed through to the native build when cross-compiling though, so the build will break if the "third-party" component is missing. We don't need the benchmarks or tests for the native build, so disable these unconditionally. This fixes cross-compiling on Gentoo, where only the required components are checked out.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141196

Files:
  llvm/cmake/modules/CrossCompile.cmake


Index: llvm/cmake/modules/CrossCompile.cmake
===================================================================
--- llvm/cmake/modules/CrossCompile.cmake
+++ llvm/cmake/modules/CrossCompile.cmake
@@ -84,6 +84,8 @@
         -DLLVM_ENABLE_RUNTIMES="${llvm_enable_runtimes_arg}"
         ${external_project_source_dirs}
         -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN="${LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN}"
+        -DLLVM_INCLUDE_BENCHMARKS=OFF
+        -DLLVM_INCLUDE_TESTS=OFF
         ${build_type_flags} ${linker_flag} ${external_clang_dir}
         ${ARGN}
     WORKING_DIRECTORY ${${project_name}_${target_name}_BUILD}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141196.487088.patch
Type: text/x-patch
Size: 627 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/e047065a/attachment.bin>


More information about the llvm-commits mailing list