2017-05-15 08:13:52 -03:00
|
|
|
# More on cross-compilation: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
|
2016-04-29 01:09:23 -03:00
|
|
|
|
2017-05-15 08:13:52 -03:00
|
|
|
set(CMAKE_SYSTEM_NAME Linux)
|
|
|
|
set(CMAKE_SYSTEM_PROCESSOR arm)
|
2016-04-29 01:09:23 -03:00
|
|
|
set(CMAKE_SYSTEM_VERSION 1)
|
|
|
|
|
2017-05-15 08:13:52 -03:00
|
|
|
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()
|
2016-04-29 01:09:23 -03:00
|
|
|
|
|
|
|
# os tools
|
2016-06-05 07:02:13 -03:00
|
|
|
foreach(tool echo grep rm mkdir nm cp touch make unzip)
|
2016-04-29 01:09:23 -03:00
|
|
|
string(TOUPPER ${tool} TOOL)
|
|
|
|
find_program(${TOOL} ${tool})
|
|
|
|
if(NOT ${TOOL})
|
|
|
|
message(FATAL_ERROR "could not find ${TOOL}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
2017-05-31 15:57:50 -03:00
|
|
|
FIND_PROGRAM(STRIP_TOOL "arm-linux-gnueabihf-strip")
|
|
|
|
|
2017-05-15 08:13:52 -03:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-gc-sections")
|
|
|
|
#set(CMAKE_C_FLAGS ${C_FLAGS})
|
|
|
|
#set(CMAKE_CXX_LINKER_FLAGS ${C_FLAGS})
|
2016-04-29 01:09:23 -03:00
|
|
|
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
2017-05-15 08:13:52 -03:00
|
|
|
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
|