set(CMAKE_SYSTEM_NAME Linux) set(TOOLCHAIN_PREFIX armv7a-unknown-linux-gnueabihf) set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}-gcc) set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}-g++) set(CMAKE_FIND_ROOT_PATH "/usr/${TOOLCHAIN_PREFIX};/usr/lib/gcc/${TOOLCHAIN_PREFIX}/;${CMAKE_CURRENT_BINARY_DIR}/deps") # modify default behavior of FIND_XXX() commands to # search for headers/libs in the target environment and # search for programs in the build host environment set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Export the chosen compiler via CXX and CC, because it's entirely possible # one of child build scripts will call out to something that relies on these # to discover the compiler (or will otherwise choose the wrong one). set ($ENV{CXX} "${CMAKE_CXX_COMPILER}") set ($ENV{CC} "${CMAKE_C_COMPILER}")