[llvm] r213091 - CMake: fix cross-compilation with external source directories
Alp Toker
alp at nuanti.com
Tue Jul 15 14:04:16 PDT 2014
Author: alp
Date: Tue Jul 15 16:04:12 2014
New Revision: 213091
URL: http://llvm.org/viewvc/llvm-project?rev=213091&view=rev
Log:
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).
Modified:
llvm/trunk/cmake/modules/TableGen.cmake
Modified: llvm/trunk/cmake/modules/TableGen.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=213091&r1=213090&r2=213091&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/TableGen.cmake (original)
+++ llvm/trunk/cmake/modules/TableGen.cmake Tue Jul 15 16:04:12 2014
@@ -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}
More information about the llvm-commits
mailing list