Merge pull request #10313 from P-I-Engineer/patch-1
[inav.git] / cmake / arm-none-eabi.cmake
blobeb7ddebabf77bdd9dcf2a5fa349e41ea15b953ef
1 set(CMAKE_SYSTEM_NAME Generic)
2 set(CMAKE_SYSTEM_PROCESSOR arm)
4 if(WIN32)
5     set(TOOL_EXECUTABLE_SUFFIX ".exe")
6 endif()
8 set(TARGET_TRIPLET "arm-none-eabi")
10 set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
11 set(CMAKE_ASM_COMPILER "${TARGET_TRIPLET}-gcc${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "asm compiler")
12 set(CMAKE_C_COMPILER "${TARGET_TRIPLET}-gcc${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "c compiler")
13 set(CMAKE_CXX_COMPILER "${TARGET_TRIPLET}-g++${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "c++ compiler")
14 set(CMAKE_OBJCOPY "${TARGET_TRIPLET}-objcopy${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "objcopy tool")
15 set(CMAKE_OBJDUMP "${TARGET_TRIPLET}-objdump${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "objdump tool")
16 set(CMAKE_SIZE "${TARGET_TRIPLET}-size${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "size tool")
17 set(CMAKE_DEBUGGER "${TARGET_TRIPLET}-gdb${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "debugger")
18 set(CMAKE_CPPFILT "${TARGET_TRIPLET}-c++filt${TOOL_EXECUTABLE_SUFFIX}" CACHE INTERNAL "c++filt")
19 set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
20 set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
21 set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
22 set(CMAKE_EXECUTABLE_SUFFIX ".elf")
24 if(NOT CMAKE_CONFIGURATION_TYPES)
25     set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo)
26 endif()
27 if(CMAKE_BUILD_TYPE STREQUAL "")
28     set(CMAKE_BUILD_TYPE RelWithDebInfo)
29 endif()
30 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "Build Type" FORCE)
31 set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
33 set(arm_none_eabi_debug "-Og -g")
34 # We set -Os or -O2 depending on the MCU family
35 set(arm_none_eabi_release "-DNDEBUG")
36 set(arm_none_eabi_relwithdebinfo "-ggdb3 ${arm_none_eabi_release}")
38 set(CMAKE_C_FLAGS_DEBUG ${arm_none_eabi_debug} CACHE INTERNAL "c compiler flags debug")
39 set(CMAKE_CXX_FLAGS_DEBUG ${arm_none_eabi_debug} CACHE INTERNAL "c++ compiler flags debug")
40 set(CMAKE_ASM_FLAGS_DEBUG ${arm_none_eabi_debug} CACHE INTERNAL "asm compiler flags debug")
42 set(CMAKE_C_FLAGS_RELEASE ${arm_none_eabi_release} CACHE INTERNAL "c compiler flags release")
43 set(CMAKE_CXX_FLAGS_RELEASE ${arm_none_eabi_release} CACHE INTERNAL "cxx compiler flags release")
44 set(CMAKE_ASM_FLAGS_RELEASE ${arm_none_eabi_release} CACHE INTERNAL "asm compiler flags release")
46 set(CMAKE_C_FLAGS_RELWITHDEBINFO ${arm_none_eabi_relwithdebinfo} CACHE INTERNAL "c compiler flags release")
47 set(CMAKE_CXX_FLAGS_RELWITHDEBINFO ${arm_none_eabi_relwithdebinfo} CACHE INTERNAL "cxx compiler flags release")
48 set(CMAKE_ASM_FLAGS_RELWITHDEBINFO ${arm_none_eabi_relwithdebinfo} CACHE INTERNAL "asm compiler flags release")