-
Notifications
You must be signed in to change notification settings - Fork 25
/
config_armgcc.cmake
44 lines (35 loc) · 1.4 KB
/
config_armgcc.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# TOOLCHAIN EXTENSION
if(WIN32)
set(toolchain_ext ".exe")
else()
set(toolchain_ext "")
endif()
set(toolchain_dir $ENV{ARMGCC_DIR})
string(REGEX REPLACE "\\\\" "/" toolchain_dir "${toolchain_dir}")
if(NOT toolchain_dir)
message(FATAL_ERROR "*** Please set ARMGCC_DIR in environment variables ***")
endif()
message(STATUS "toolchain_dir: " ${toolchain_dir})
set(target_prefix $ENV{TARGET_PREFIX})
if(NOT target_prefix)
set(target_prefix "arm-none-eabi-")
message(WARNING "*** TARGET_PREFIX environment variable not found, defaults to ${target_prefix} ***")
endif()
set(toolchain_bin_dir ${toolchain_dir}/bin)
set(toolchain_inc_dir ${toolchain_dir}/${target_prefix}/include)
set(toolchain_lib_dir ${toolchain_dir}/${target_prefix}/lib)
if(target_prefix MATCHES "linux")
set(CMAKE_SYSTEM_NAME Linux)
else()
set(CMAKE_SYSTEM_NAME Generic)
endif()
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_C_COMPILER ${toolchain_bin_dir}/${target_prefix}gcc${toolchain_ext})
set(CMAKE_CXX_COMPILER ${toolchain_bin_dir}/${target_prefix}g++${toolchain_ext})
set(CMAKE_ASM_COMPILER ${toolchain_bin_dir}/${target_prefix}gcc${toolchain_ext})
set(CMAKE_FIND_ROOT_PATH ${toolchain_dir}/${target_prefix} ${extra_find_path})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_C_COMPILER_FORCED TRUE)
set(CMAKE_CXX_COMPILER_FORCED TRUE)