llvm.org GIT mirror llvm / 9bc72a3
CMake: fix cross-compilation with external source directories This adds support for building native artifacts when cross-compiling using the popular side-by-side source directory layout (no symlinks, no nested repositories). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213091 91177308-0d34-0410-b5e6-96231b3b80d8 Alp Toker 5 years ago
1 changed file(s) with 11 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
7676 COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
7777 COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
7878
79 # Forward a subset of configure options to discover additional tablegen modules.
80 get_cmake_property(_variableNames CACHE_VARIABLES)
81 foreach (_variableName ${_variableNames})
82 if (_variableName MATCHES "^(LLVM_EXTERNAL_.*_SOURCE_DIR)$")
83 list(APPEND CX_CMAKE_ARGUMENTS "-D${_variableName}=\"${${_variableName}}\"")
84 endif ()
85 endforeach()
86
7987 add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
88 # Remove the old cache to avoid persisting previous flags.
89 COMMAND ${CMAKE_COMMAND} -E remove ${CX_NATIVE_TG_DIR}/CMakeCache.txt
8090 COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release
81 -DLLVM_BUILD_POLLY=OFF
91 -DLLVM_BUILD_POLLY=OFF ${CX_CMAKE_ARGUMENTS}
8292 -G "${CMAKE_GENERATOR}" ${CMAKE_SOURCE_DIR}
8393 WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
8494 DEPENDS ${CX_NATIVE_TG_DIR}