set(CMAKE_SYSTEM_NAME MaxOS)

# Define the cross-compiler locations
set(TOOLCHAIN_ROOT_DIR ${CMAKE_SOURCE_DIR}/toolchain/cross_compiler/cross)
set(TOOLCHAIN_BIN_DIR ${TOOLCHAIN_ROOT_DIR}/bin/)
set(TOOLCHAIN_PLATFORM x86_64-elf)
set(TOOLCHAIN_PREFIX ${TOOLCHAIN_PLATFORM}-)

# Set the type of CPU we are compiling for
set(CMAKE_SYSTEM_PROCESSOR x86_64)

# Set the compiler flags
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/toolchain/CMake")

# Set the executables
set(CMAKE_C_COMPILER ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}gcc)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}g++)
set(CMAKE_LINKER ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}ld)
set(CMAKE_ASM_COMPILER ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}as)
set(CMAKE_STRIP ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}strip)
set(CMAKE_AR ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}ar)
set(CMAKE_RANLIB ${TOOLCHAIN_BIN_DIR}${TOOLCHAIN_PREFIX}ranlib)

# Set where to look for the target 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)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH)

# Tell it not to check the compiler
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
