set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR $ENV{ARCH})

set(triple $ENV{TRIPLE})

set(CMAKE_C_COMPILER clang-13)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER clang++-13)
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CROSS_LINKER_FLAGS "-fuse-ld=lld -Wl,--dynamic-linker=/usr/${triple}/lib/$ENV{RTLD_NAME},-rpath,/usr/${triple}/lib")
set(CMAKE_EXE_LINKER_FLAGS ${CROSS_LINKER_FLAGS})
set(CMAKE_SHARED_LINKER_FLAGS ${CROSS_LINKER_FLAGS})
set(CMAKE_MODULE_LINKER_FLAGS ${CROSS_LINKER_FLAGS})
