set(CMAKE_SYSTEM_NAME Linux)
set(SNN_SYSROOT_DIR $ENV{SNN_SYSROOT_DIR})
set(SNN_TOOLCHAIN_DIR $ENV{SNN_TOOLCHAIN_DIR})
set(SNN_TARGET_TRIPLE $ENV{SNN_TARGET_TRIPLE})

if(NOT SNN_SYSROOT_DIR OR
  NOT SNN_TOOLCHAIN_DIR OR
  NOT SNN_TARGET_TRIPLE
)
  message(FATAL_ERROR
    "Please set all of SNN_TARGET_TRIPLE, SNN_SYSROOT_DIR and "
    "SNN_TOOLCHAIN_DIR in the environment when crosscompiling.")
endif()

set(CMAKE_SYSROOT ${SNN_SYSROOT_DIR})
set(CMAKE_C_COMPILER ${SNN_TOOLCHAIN_DIR}/bin/${SNN_TARGET_TRIPLE}-gcc)
set(CMAKE_CXX_COMPILER ${SNN_TOOLCHAIN_DIR}/bin/${SNN_TARGET_TRIPLE}-g++)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
