My CMake project for ARM Cortex-M4 contains:
The generated executable is:
Is it possible to specify that the executable file type should be ‘.axf’ instead of ‘.elf’?
I suspect you need your toolchain file to set the
CMAKE_EXECUTABLE_SUFFIX variable properly. If it is actually a different file format (and not just an extension), then flags need to be set up in the toolchain as well.
CMAKE_EXECUTABLE_SUFFIX in a toolchain file doesn’t work. CMake overwrites it if you do. You have to set it after enabling the languages you want, or ensure it gets set as part of the platform file processing. See this merge request which adds a new
Generic-ELF platform module (for CMake 3.23) and contains links to various issues where this has come up before.