I’m running an arm-none-eabi-gcc cross-compiler, version 5.4.1 20160919, on two different systems and, on setting up my CMake configuration, the compiler checks fail.
The workaround I’m currently resorting to is manually set the CMAKE_C_COMPILER_WORKS variable
set(CMAKE_C_COMPILER_WORKS 1)
which I’m not quite happy with. My CMake setup relies on three distinct files, CMakeLists.txt, toolchains/uarm.cmake and uarm.cmake, which you can find here (if you allow me, I’ll upload the archive directly on discourse).
Once you download the archive, you can build a sample program with
make build
cd build
cmake -D CMAKE_TOOLCHAIN_FILE=../toolchains/uarm.cmake ..
make kernel.uarm
Is the problem I’m dealing with inherent to the compiler (version) or to my CMake setup? If the latter, can I solve it?
I’m going to say that this is the easiest method as part of cross compiling. Setting a toolchain file doesn’t trigger cross compiling mode by itself.
If you don’t set CMAKE_SYSTEM_NAME then CMake assumes you are building for the host, and will set various language and compiler settings to be compatible with the host. You don’t want this if you are using arm-none-eabi-gcc. The Generic System is appropriate and has worked for me for other cross compilers.