# Simple toolchain template file for clang running on {{ARCH}} {{OS}}
set(CMAKE_SYSTEM_NAME {{OS}})
set(CMAKE_SYSTEM_PROCESSOR {{ARCH}})

set(CMAKE_SYSROOT /opt/{{TARGET}}/{{TARGET}}/sys-root/)
set(CMAKE_INSTALL_PREFIX $ENV{prefix})

set(CMAKE_C_COMPILER /opt/x86_64-linux-gnu/tools/clang)
set(CMAKE_CXX_COMPILER /opt/x86_64-linux-gnu/tools/clang++)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -target {{TARGET}} --sysroot ${CMAKE_SYSROOT} -gcc-toolchain /opt/{{TARGET}}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -target {{TARGET}} --sysroot ${CMAKE_SYSROOT} -gcc-toolchain /opt/{{TARGET}}")

if( $ENV{CC} MATCHES ccache )
    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
endif()

