You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
910 B
30 lines
910 B
# More on cross-compilation: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html |
|
|
|
set(CMAKE_SYSTEM_NAME Linux) |
|
set(CMAKE_SYSTEM_PROCESSOR arm) |
|
set(CMAKE_SYSTEM_VERSION 1) |
|
|
|
IF (NOT CMAKE_C_COMPILER OR NOT CMAKE_CXX_COMPILER) |
|
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc) |
|
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++) |
|
ENDIF() |
|
|
|
# os tools |
|
foreach(tool echo grep rm mkdir nm cp touch make unzip) |
|
string(TOUPPER ${tool} TOOL) |
|
find_program(${TOOL} ${tool}) |
|
if(NOT ${TOOL}) |
|
message(FATAL_ERROR "could not find ${TOOL}") |
|
endif() |
|
endforeach() |
|
|
|
FIND_PROGRAM(STRIP_TOOL "arm-linux-gnueabihf-strip") |
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections") |
|
#set(CMAKE_C_FLAGS ${C_FLAGS}) |
|
#set(CMAKE_CXX_LINKER_FLAGS ${C_FLAGS}) |
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|
|
|