# man cmake-toolchains

if(NOT RTEMS_BSP)
    message(FATAL_ERROR "toolchain must set RTEMS_BSP")
endif()
if(NOT RTEMS_PREFIX)
    message(FATAL_ERROR "toolchain must set RTEMS_PREFIX")
endif()

set(RTEMS_TARGET_PREFIX "${RTEMS_PREFIX}/${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}")
set(RTEMS_TOOL_PREFIX "${RTEMS_PREFIX}/bin/${CMAKE_SYSTEM_PROCESSOR}-rtems${CMAKE_SYSTEM_VERSION}")


set(CMAKE_C_COMPILER ${RTEMS_TOOL_PREFIX}-gcc)
set(CMAKE_CXX_COMPILER ${RTEMS_TOOL_PREFIX}-g++)
set(CMAKE_OBJCOPY ${RTEMS_TOOL_PREFIX}-objcopy)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
