-
Notifications
You must be signed in to change notification settings - Fork 19
Mixing C and Assembly source code
Felipe Torrezan edited this page Mar 18, 2024
·
6 revisions
This interactive example describes the configuration details for when, in a CMake project, a target is comprised of C sources (*.c) and Assembly sources (*.s).
A CMake project example is provided at:
| Project files |
|---|
CMakeLists.txt |
fun.h |
fun.s |
main.c |
The public function fun() in fun.s returns 42 and is consumed by the application's main() function.
Perform the following tasks on CMakeLists.txt (click to show/hide answers):
TODO 1: Enable Assembly for the project
project(Mix LANGUAGES C ASM)
TODO 2: Add `fun.s` source to the `mix` target in the `CMakeLists.txt`
target_sources(mix PRIVATE
main.c
fun.s)
Finally build and test the project. Refer to the tutorial for more information.
This is the cmake-tutorial wiki. Back to Wiki Home
- IAR Compiler options in a CMake project
- IAR ILINK options in a CMake project
- Language-specific target options
- Selecting build types
- Using Ninja Multi-Config
- Filing a build log
- Multi-file compilation
- Invoking IAR binary utilities
- Use the IAR ELF Tool to convert executable targets to their binary formats
- Using IAR Build Tools with CMake Presets