Mixing C and Assembly source code - IARSystems/cmake-tutorial GitHub Wiki
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 examples/mix:
| 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.