Skip to content

Commit e5e75af

Browse files
committedSep 9, 2015
[CMake] Flag recursive cmake invocations for cross-compile
Summary: 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. Reviewers: rnk, beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12679 llvm-svn: 247151
1 parent e283441 commit e5e75af

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
 

‎llvm/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,10 @@ include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR})
560560
if(LLVM_USE_HOST_TOOLS)
561561
include(CrossCompile)
562562
endif(LLVM_USE_HOST_TOOLS)
563+
if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
564+
# Dummy use to avoid CMake Wraning: Manually-specified variables were not used
565+
# (this is a variable that CrossCompile sets on recursive invocations)
566+
endif()
563567

564568
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
565569
# On FreeBSD, /usr/local/* is not used by default. In order to build LLVM

‎llvm/cmake/modules/CrossCompile.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function(llvm_create_cross_target_internal target_name toochain buildtype)
1919
add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt
2020
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
2121
${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
22+
-DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
2223
WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
2324
DEPENDS ${LLVM_${target_name}_BUILD}
2425
COMMENT "Configuring ${target_name} LLVM...")
@@ -43,6 +44,7 @@ function(llvm_create_cross_target_internal target_name toochain buildtype)
4344
execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags}
4445
-G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}
4546
${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
47+
-DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
4648
WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} )
4749
endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD})
4850

0 commit comments

Comments
 (0)
Please sign in to comment.