I have been using CMake as a build system generator to cross compile for ARM Cortex M microcontrollers for a while now, and to great success (well, honestly it was only successful after I bought @craig.scott 's book).
Now I may have run into an issue with the extensibility of the cross-compilation support.
I’d like to be able to build unit tests for my project using CppUTest/CppUMock along side the app as a separate build target. The tests would just test the business logic portions of my application on my host machine, with hardware components mocked out, meaning I’d want it to compile and run the tests on my HOST system.
I use the cortex M version of GCC (arm-none-eabi-gcc
) as a compiler for the microcontroller app. But the code that will be under test has been verified to be hardware agnostic and compile under both arm-none-eabi-gcc
and standard x86_64 GCC. So I know the app code under test would support this
What I can’t figure out how to create a target that uses a different compiler from the other targets though… Is this possible?
I’d like to build my app target (and associated library targets) using arm-none-eabi-gcc
but build my tests with the host system compiler.
Seems simple, but I can’t figure it out?
Any and all help appreciated!