Skip to content

Instantly share code, notes, and snippets.

@farleylai
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save farleylai/c329dba2996ef7acde1b to your computer and use it in GitHub Desktop.
Save farleylai/c329dba2996ef7acde1b to your computer and use it in GitHub Desktop.
Toolchain file for CMake cross-compilation.
SET(CMAKE_SYSTEM_NAME Linux)
#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)
# specify the cross compiler
SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc -mfloat-abi=hard)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++ -mfloat-abi=hard)
set(CMAKE_AR arm-linux-gnueabihf-ar CACHE FILEPATH "Archiver")
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH /usr/local/linaro/arm-linux-gnueabihf/arm-linux-gnueabihf/libc)
# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment