# 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)