[PATCH] D12679: [CMake] Flag recursive cmake invocations for cross-compile

Joseph Tremoulet via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 7 09:52:53 PDT 2015

JosephTremoulet created this revision.
JosephTremoulet added reviewers: beanz, rnk.
JosephTremoulet added a subscriber: llvm-commits.

Cross-compilation uses recursive cmake invocations to build native host
tools.  These recursive invocations only forward a fixed set of
variables/options, since the native environment is generally the default.
This change adds -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE to the recursive
cmake invocations, so that cmake files can distinguish these recursive
invocations from top-level ones, which can explain why expected options
are unset.

LLILC will use this to avoid trying to generate its build rules in the
crosscompile native host target (where it is not needed), which would fail
if attempted because LLILC requires a cmake variable passed on the command
line, which is not forwarded in the recursive invocation.



Index: cmake/modules/CrossCompile.cmake
--- cmake/modules/CrossCompile.cmake
+++ cmake/modules/CrossCompile.cmake
@@ -19,6 +19,7 @@
   add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt
         ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
     WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
     DEPENDS ${LLVM_${target_name}_BUILD}
     COMMENT "Configuring ${target_name} LLVM...")
@@ -43,6 +44,7 @@
     execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags}
         ${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
       WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} )
   endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD})
Index: CMakeLists.txt
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -560,6 +560,10 @@
+# Dummy use to avoid CMake Wraning: Manually-specified variables were not used
+# (this is a variable that CrossCompile sets on recursive invocations)
   # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12679.34166.patch
Type: text/x-patch
Size: 1549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150907/00956bfe/attachment.bin>

More information about the llvm-commits mailing list