summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorJordan Williams <jordan@jwillikers.com>2021-10-18 15:22:18 (GMT)
committerJordan Williams <jordan@jwillikers.com>2021-10-19 15:02:04 (GMT)
commit3f9b40dab7345cea8864b11a4af7847988075827 (patch)
tree4e1d142b1256fb58037191b09286a38e0bd5f76b /Modules
parentc5ae200d94333600117fc93e50c66bdd50994bbc (diff)
downloadCMake-3f9b40dab7345cea8864b11a4af7847988075827.zip
CMake-3f9b40dab7345cea8864b11a4af7847988075827.tar.gz
CMake-3f9b40dab7345cea8864b11a4af7847988075827.tar.bz2
Generic-ELF: Add platform module to configure the .elf file extension
The `.elf` extension is a common convention used for embedded binaries. Both Arm and RISC-V use the ELF file format for executables. Configuring the `.elf` file extension is typically done incorrectly. Most embedded developers set this in toolchain files, which is not the correct place. This is typically accomplished through a hack by setting the individual language file extensions for C, CXX, and ASM. Multiple CMake issues in the past have been opened related to this. * #16538 * #20163 * #17880 A platform module makes it simpler and less error prone for developers targeting these ubiquitous bare-metal platforms. This PR attempts to solve this globally with a generic platform. This could also be solved by using more specific platform modules, such as one for each of bare-metal Arm and RISC-V.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/Platform/Generic-ELF.cmake7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/Platform/Generic-ELF.cmake b/Modules/Platform/Generic-ELF.cmake
new file mode 100644
index 0000000..943cb6b
--- /dev/null
+++ b/Modules/Platform/Generic-ELF.cmake
@@ -0,0 +1,7 @@
+# This is a platform definition file for platforms without
+# an operating system using the ELF executable format.
+# It is used when CMAKE_SYSTEM_NAME is set to "Generic-ELF"
+
+include(Platform/Generic)
+
+set(CMAKE_EXECUTABLE_SUFFIX .elf)