-
Notifications
You must be signed in to change notification settings - Fork 17
Mixing C and Assembly source code
Felipe Torrezan edited this page Jan 28, 2024
·
5 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
- Setting 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