include(CMakeForceCompiler)

set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR x86_64)

set(CMAKE_C_COMPILER   x86_64-elf-gcc)
set(CMAKE_CXX_COMPILER x86_64-elf-g++)
set(CMAKE_ASM_COMPILER x86_64-elf-gcc)
set(CMAKE_LINKER x86_64-elf-ld)

unset(CMAKE_C_FLAGS CACHE)
set(CMAKE_C_FLAGS "-m64 -z max-page-size=0x1000" CACHE STRING "" FORCE)

unset(CMAKE_ASM_FLAGS CACHE)
set(CMAKE_ASM_FLAGS "-m64 -z max-page-size=0x1000" CACHE STRING "" FORCE)

unset(CMAKE_CXX_FLAGS CACHE)
set(CMAKE_CXX_FLAGS "-m64 -z max-page-size=0x1000" CACHE STRING "" FORCE)

unset(CMAKE_C_LINK_FLAGS CACHE)
set(CMAKE_C_LINK_FLAGS "-Xlinker -melf_x86_64" CACHE STRING "" FORCE)

unset(CMAKE_CXX_LINK_FLAGS CACHE)
set(CMAKE_CXX_LINK_FLAGS "-Xlinker -melf_x86_64" CACHE STRING "" FORCE)

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_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
