gcc-arm-none-eabi.cmake 1.1 KB

1234567891011121314151617181920212223242526
  1. set(CMAKE_SYSTEM_NAME Generic)
  2. set(CMAKE_SYSTEM_PROCESSOR arm)
  3. # Some default GCC settings
  4. # arm-none-eabi- must be part of path environment
  5. set(TOOLCHAIN_PREFIX arm-none-eabi-)
  6. set(FLAGS "-fdata-sections -ffunction-sections --specs=nano.specs -Wl,--gc-sections")
  7. set(CPP_FLAGS "-fno-rtti -fno-exceptions -fno-threadsafe-statics")
  8. set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc ${FLAGS})
  9. set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
  10. set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++ ${FLAGS} ${CPP_FLAGS})
  11. set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
  12. set(CMAKE_SIZE ${TOOLCHAIN_PREFIX}size)
  13. set(CMAKE_EXECUTABLE_SUFFIX_ASM ".elf")
  14. set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
  15. set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf")
  16. set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
  17. if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
  18. execute_process(
  19. COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/compile_commands.json ${CMAKE_SOURCE_DIR}/compile_commands.json
  20. )
  21. endif()