본문으로 건너뛰기

LLVM Cross-compile

CMake

cmake_minimum_required(VERSION 3.15)

project(example)

set(CMAKE_SYSROOT /path/to/sysroot)
set(TRIPLE aarch64-linux-gnu)

set(TOOLCHAIN /opt/toolchain/clang/11)
set(CMAKE_C_COMPILER ${TOOLCHAIN}/bin/clang)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN}/bin/clang++)

set(SOURCE
main.cpp
)

add_executable(example ${SOURCE})

target_compile_options(example PRIVATE --target=${TRIPLE})

target_link_options(example PRIVATE --target=${TRIPLE})