Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CMake template for using Clang + ARM toolchain
cmake_minimum_required(VERSION 3.2)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(gcc_toolchain "$ENV{USERPROFILE}\\Documents\\Projects\\toolchains\\gcc-mingw32-arm-linux-gnueabihf")
set(triple arm-linux-gnueabihf)
set(cpu_type cortex-a7)
set(fpu_type neon-vfpv4)
set(float_abi_type hard)
set(CMAKE_C_COMPILER clang)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN ${gcc_toolchain})
set(CMAKE_SYSROOT ${gcc_toolchain}\\arm-linux-gnueabihf\\libc)
set(CMAKE_C_FLAGS_INIT "${CMAKE_C_FLAGS_INIT} -B${gcc_toolchain}\\bin -mcpu=${cpu_type} -mfpu=${fpu_type} -mfloat-abi=${float_abi_type}")
project(arm_test C)
set(arm_test_SRC main.c)
add_executable(arm_test ${arm_test_SRC})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.