aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorOscar Fuentes <ofv@wanadoo.es>2008-11-09 18:53:19 +0000
committerOscar Fuentes <ofv@wanadoo.es>2008-11-09 18:53:19 +0000
commit3ab40ca3d507ec9d212a3ba498e0d6837634a5ad (patch)
treedaf087f18dcc1051cf371f7248aa84780d017daa /cmake
parent22b91d7fc47b9667453d56a23eac2b2f7afe9b57 (diff)
CMake: Support for cross-compiling. For now, requires a previously
built native tblgen which is passed to cmake in the variable LLVM_TABLEGEN. See http://www.cmake.org/Wiki/CmakeMingw for a quick example on how to cross-compile with CMake. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58939 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-xcmake/modules/AddPartiallyLinkedObject.cmake2
-rw-r--r--cmake/modules/CrossCompileLLVM.cmake6
-rw-r--r--cmake/modules/TableGen.cmake2
3 files changed, 8 insertions, 2 deletions
diff --git a/cmake/modules/AddPartiallyLinkedObject.cmake b/cmake/modules/AddPartiallyLinkedObject.cmake
index 4da8eac3f2..d607306dfe 100755
--- a/cmake/modules/AddPartiallyLinkedObject.cmake
+++ b/cmake/modules/AddPartiallyLinkedObject.cmake
@@ -24,7 +24,7 @@ macro(add_partially_linked_object lib)
DEPENDS ${lib}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/temp_lib
COMMAND ar x ${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}
- COMMAND ld "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
+ COMMAND ${CMAKE_LINKER} "${LLVM_PLO_FLAGS}" -r "*${CMAKE_CXX_OUTPUT_EXTENSION}" -o ${pll}
COMMAND rm -f *${CMAKE_CXX_OUTPUT_EXTENSION}
)
target_name_of_partially_linked_object(${lib} tnplo)
diff --git a/cmake/modules/CrossCompileLLVM.cmake b/cmake/modules/CrossCompileLLVM.cmake
new file mode 100644
index 0000000000..0377c05614
--- /dev/null
+++ b/cmake/modules/CrossCompileLLVM.cmake
@@ -0,0 +1,6 @@
+# TODO: Build a native tblgen when cross-compiling, if the user
+# didn't set LLVM_TABLEGEN. Then, remove this check:
+if( CMAKE_CROSSCOMPILING AND ${LLVM_TABLEGEN} STREQUAL "tblgen" )
+ message(FATAL_ERROR
+ "Set LLVM_TABLEGEN to the full route to a native tblgen executable")
+endif()
diff --git a/cmake/modules/TableGen.cmake b/cmake/modules/TableGen.cmake
index c332ed1ac4..6d69e8ae91 100644
--- a/cmake/modules/TableGen.cmake
+++ b/cmake/modules/TableGen.cmake
@@ -4,7 +4,7 @@
macro(tablegen ofn)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ofn}
- COMMAND tblgen ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn}
+ COMMAND ${LLVM_TABLEGEN} ${ARGN} -I ${CMAKE_CURRENT_SOURCE_DIR} -I ${CMAKE_SOURCE_DIR}/lib/Target -I ${LLVM_MAIN_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS} -o ${ofn}
DEPENDS tblgen ${CMAKE_CURRENT_SOURCE_DIR}/${LLVM_TARGET_DEFINITIONS}
COMMENT "Building ${ofn}..."
)