• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1set(CMAKE_SYSTEM_NAME Linux)
2set(CMAKE_SYSTEM_PROCESSOR arm)
3set(CMAKE_SYSTEM_VERSION 1)
4
5message(STATUS "Using cross-compile toolchain: ${CMAKE_C_COMPILER_TARGET}")
6
7set(CMAKE_CROSSCOMPILING TRUE)
8set(CMAKE_CROSSCOMPILING_EMULATOR qemu-arm -L /usr/${CMAKE_C_COMPILER_TARGET}/)
9
10set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
11set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
12set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
13set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
14
15find_program(C_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-gcc)
16if(NOT C_COMPILER_FULL_PATH)
17    message(FATAL_ERROR "Cross-compiler ${CMAKE_C_COMPILER_TARGET}-gcc not found")
18endif()
19set(CMAKE_C_COMPILER ${C_COMPILER_FULL_PATH})
20
21find_program(CXX_COMPILER_FULL_PATH ${CMAKE_C_COMPILER_TARGET}-g++)
22if(CXX_COMPILER_FULL_PATH)
23    set(CMAKE_CXX_COMPILER ${CXX_COMPILER_FULL_PATH})
24endif()
25