1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

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).

llvm-svn: 213091
This commit is contained in:
Alp Toker 2014-07-15 21:04:12 +00:00
parent 920db48687
commit 7013c592c2

View File

@ -77,9 +77,19 @@ if(CMAKE_CROSSCOMPILING)
COMMAND ${CMAKE_COMMAND} -E make_directory ${CX_NATIVE_TG_DIR}
COMMENT "Creating ${CX_NATIVE_TG_DIR}...")
# Forward a subset of configure options to discover additional tablegen modules.
get_cmake_property(_variableNames CACHE_VARIABLES)
foreach (_variableName ${_variableNames})
if (_variableName MATCHES "^(LLVM_EXTERNAL_.*_SOURCE_DIR)$")
list(APPEND CX_CMAKE_ARGUMENTS "-D${_variableName}=\"${${_variableName}}\"")
endif ()
endforeach()
add_custom_command(OUTPUT ${CX_NATIVE_TG_DIR}/CMakeCache.txt
# Remove the old cache to avoid persisting previous flags.
COMMAND ${CMAKE_COMMAND} -E remove ${CX_NATIVE_TG_DIR}/CMakeCache.txt
COMMAND ${CMAKE_COMMAND} -UMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=Release
-DLLVM_BUILD_POLLY=OFF
-DLLVM_BUILD_POLLY=OFF ${CX_CMAKE_ARGUMENTS}
-G "${CMAKE_GENERATOR}" ${CMAKE_SOURCE_DIR}
WORKING_DIRECTORY ${CX_NATIVE_TG_DIR}
DEPENDS ${CX_NATIVE_TG_DIR}