diff options
author | Alp Toker <alp@nuanti.com> | 2014-07-15 21:04:12 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2014-07-15 21:04:12 +0000 |
commit | a507bb590355e6935fac6e902609b46ad52be11c (patch) | |
tree | a7a955ef403d22ccae6f9c4180617317c61be9b7 | |
parent | f51601c856d38b5654f933e30b887282f7676399 (diff) | |
download | bcm5719-llvm-a507bb590355e6935fac6e902609b46ad52be11c.tar.gz bcm5719-llvm-a507bb590355e6935fac6e902609b46ad52be11c.zip |
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
-rw-r--r-- | llvm/cmake/modules/TableGen.cmake | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake index 34b03430b26..e46b4ae240b 100644 --- a/llvm/cmake/modules/TableGen.cmake +++ b/llvm/cmake/modules/TableGen.cmake @@ -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} |