[llvm] r247151 - [CMake] Flag recursive cmake invocations for cross-compile
Joseph Tremoulet via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 07:57:06 PDT 2015
Author: josepht
Date: Wed Sep 9 09:57:06 2015
New Revision: 247151
URL: http://llvm.org/viewvc/llvm-project?rev=247151&view=rev
Log:
[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
Modified:
llvm/trunk/CMakeLists.txt
llvm/trunk/cmake/modules/CrossCompile.cmake
Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=247151&r1=247150&r2=247151&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Wed Sep 9 09:57:06 2015
@@ -560,6 +560,10 @@ include_directories( ${LLVM_INCLUDE_DIR}
if(LLVM_USE_HOST_TOOLS)
include(CrossCompile)
endif(LLVM_USE_HOST_TOOLS)
+if(LLVM_TARGET_IS_CROSSCOMPILE_HOST)
+# Dummy use to avoid CMake Wraning: Manually-specified variables were not used
+# (this is a variable that CrossCompile sets on recursive invocations)
+endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
# On FreeBSD, /usr/local/* is not used by default. In order to build LLVM
Modified: llvm/trunk/cmake/modules/CrossCompile.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CrossCompile.cmake?rev=247151&r1=247150&r2=247151&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/CrossCompile.cmake (original)
+++ llvm/trunk/cmake/modules/CrossCompile.cmake Wed Sep 9 09:57:06 2015
@@ -19,6 +19,7 @@ function(llvm_create_cross_target_intern
add_custom_command(OUTPUT ${LLVM_${target_name}_BUILD}/CMakeCache.txt
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}"
${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
+ -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
WORKING_DIRECTORY ${LLVM_${target_name}_BUILD}
DEPENDS ${LLVM_${target_name}_BUILD}
COMMENT "Configuring ${target_name} LLVM...")
@@ -43,6 +44,7 @@ function(llvm_create_cross_target_intern
execute_process(COMMAND ${CMAKE_COMMAND} ${build_type_flags}
-G "${CMAKE_GENERATOR}" -DLLVM_TARGETS_TO_BUILD=${LLVM_TARGETS_TO_BUILD}
${CROSS_TOOLCHAIN_FLAGS_${target_name}} ${CMAKE_SOURCE_DIR}
+ -DLLVM_TARGET_IS_CROSSCOMPILE_HOST=TRUE
WORKING_DIRECTORY ${LLVM_${target_name}_BUILD} )
endif(NOT IS_DIRECTORY ${LLVM_${target_name}_BUILD})
More information about the llvm-commits
mailing list