Skip to content

Commit bdbeea1

Browse files
authored
Create cxarm.cmake
1 parent c49b0b5 commit bdbeea1

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

tutorial/cxarm.cmake

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Toolchain File for the IAR C/C++ Compiler (CX)
2+
3+
# Set CMake for cross-compiling
4+
set(CMAKE_SYSTEM_NAME Generic)
5+
6+
# Set CMake to use the IAR C/C++ Compiler from the IAR Build Tools for Arm
7+
# Update if using a different supported target or operating system
8+
set(CMAKE_ASM_COMPILER /opt/iar/cxarm/arm/bin/iasmarm)
9+
set(CMAKE_C_COMPILER /opt/iar/cxarm/arm/bin/iccarm)
10+
set(CMAKE_CXX_COMPILER /opt/iar/cxarm/arm/bin/iccarm)
11+
12+
# Avoids running the linker during try_compile()
13+
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
14+
15+
# Set the default build tool for Ninja gnerators
16+
# Reasonably recent IAR products ships with ninja (https://ninja-build.org)
17+
# The CMake code block below tries to find it. If not found,
18+
# manually install the desired build system in your operating system
19+
# Alternatively: set(CMAKE_MAKE_PROGRAM "/usr/bin/ninja")
20+
if(CMAKE_GENERATOR MATCHES "^Ninja.*$")
21+
find_program(CMAKE_MAKE_PROGRAM
22+
NAMES ninja
23+
PATHS $ENV{PATH}
24+
/opt/iar/cxarm/common/bin
25+
REQUIRED)
26+
endif()

0 commit comments

Comments
 (0)