12345678910111213141516171819202122232425262728 |
- set(CMAKE_SYSTEM_NAME Generic)
- set(CMAKE_SYSTEM_PROCESSOR arm)
- # Some default GCC settings
- # arm-none-eabi- must be part of path environment
- set(TOOLCHAIN_PREFIX arm-none-eabi-)
- set(C_FLAGS "-Wall -Wextra -Wpedantic -fdata-sections -ffunction-sections --specs=nano.specs -Wl,--gc-sections")
- set(ASM_FLAGS "-x assembler-with-cpp -MMD -MP")
- set(CPP_FLAGS "-fno-rtti -fno-exceptions -fno-threadsafe-statics")
- set(CMAKE_C_COMPILER ${TOOLCHAIN_PREFIX}gcc ${C_FLAGS})
- set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER})
- set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}g++ ${C_FLAGS} ${CPP_FLAGS})
- set(CMAKE_LINKER ${TOOLCHAIN_PREFIX}g++)
- set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
- set(CMAKE_SIZE ${TOOLCHAIN_PREFIX}size)
- set(CMAKE_EXECUTABLE_SUFFIX_ASM ".elf")
- set(CMAKE_EXECUTABLE_SUFFIX_C ".elf")
- set(CMAKE_EXECUTABLE_SUFFIX_CXX ".elf")
- set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
- if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_BINARY_DIR}/compile_commands.json ${CMAKE_SOURCE_DIR}/compile_commands.json
- )
- endif()
|